/usr/share/doc/libxt-dev/intrinsics.html is in libxt-doc 1:1.1.5-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 17030 17031 17032 17033 17034 17035 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 17077 17078 17079 17080 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 17250 17251 17252 17253 17254 17255 17256 17257 17258 17259 17260 17261 17262 17263 17264 17265 17266 17267 17268 17269 17270 17271 17272 17273 17274 17275 17276 17277 17278 17279 17280 17281 17282 17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 17372 17373 17374 17375 17376 17377 17378 17379 17380 17381 17382 17383 17384 17385 17386 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 17397 17398 17399 17400 17401 17402 17403 17404 17405 17406 17407 17408 17409 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 17464 17465 17466 17467 17468 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 17667 17668 17669 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 18566 18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 19042 19043 19044 19045 19046 19047 19048 19049 19050 19051 19052 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 19067 19068 19069 19070 19071 19072 19073 19074 19075 19076 19077 19078 19079 19080 19081 19082 19083 19084 19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 19139 19140 19141 19142 19143 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 19164 19165 19166 19167 19168 19169 19170 19171 19172 19173 19174 19175 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 19200 19201 19202 19203 19204 19205 19206 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 19226 19227 19228 19229 19230 19231 19232 19233 19234 19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 19271 19272 19273 19274 19275 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 19294 19295 19296 19297 19298 19299 19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 19323 19324 19325 19326 19327 19328 19329 19330 19331 19332 19333 19334 19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 19360 19361 19362 19363 19364 19365 19366 19367 19368 19369 19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 19395 19396 19397 19398 19399 19400 19401 19402 19403 19404 19405 19406 19407 19408 19409 19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 19420 19421 19422 19423 19424 19425 19426 19427 19428 19429 19430 19431 19432 19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 19471 19472 19473 19474 19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 19582 19583 19584 19585 19586 19587 19588 19589 19590 19591 19592 19593 19594 19595 19596 19597 19598 19599 19600 19601 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>X Toolkit Intrinsics - C Language Interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><style xmlns="" type="text/css">/*
* Copyright (c) 2011 Gaetan Nadon
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* Shared stylesheet for X.Org documentation translated to HTML format
* http://www.sagehill.net/docbookxsl/UsingCSS.html
* http://www.w3schools.com/css/default.asp
* https://addons.mozilla.org/en-US/firefox/addon/web-developer/developers
* https://addons.mozilla.org/en-US/firefox/addon/font-finder/
*/
/*
* The sans-serif fonts are considered more legible on a computer screen
* http://dry.sailingissues.com/linux-equivalents-verdana-arial.html
*
*/
body {
font-family: "Bitstream Vera Sans", "DejaVu Sans", Tahoma, Geneva, Arial, Sans-serif;
/* In support of using "em" font size unit, the w3c recommended method */
font-size: 100%;
}
/*
* Selection: all elements requiring mono spaced fonts.
*
* The family names attempt to match the proportionally spaced font
* family names such that the same font name is used for both.
* We'd like to use Bitstream, for example, in both proportionally and
* mono spaced font text.
*/
.command,
.errorcode,
.errorname,
.errortype,
.filename,
.funcsynopsis,
.function,
.parameter,
.programlisting,
.property,
.screen,
.structname,
.symbol,
.synopsis,
.type
{
font-family: "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Courier, "Liberation Mono", Monospace;
}
/*
* Books have a title page, a preface, some chapters and appendices,
* a glossary, an index and a bibliography, in that order.
*
* An Article has no preface and no chapters. It has sections, appendices,
* a glossary, an index and a bibliography.
*/
/*
* Selection: book main title and subtitle
*/
div.book>div.titlepage h1.title,
div.book>div.titlepage h2.subtitle {
text-align: center;
}
/*
* Selection: article main title and subtitle
*/
div.article>div.titlepage h2.title,
div.article>div.titlepage h3.subtitle,
div.article>div.sect1>div.titlepage h2.title,
div.article>div.section>div.titlepage h2.title {
text-align: center;
}
/*
* Selection: various types of authors and collaborators, individuals or corporate
*
* These authors are not always contained inside an authorgroup.
* They can be contained inside a lot of different parent types where they might
* not be centered.
* Reducing the margin at the bottom makes a visual separation between authors
* We specify here the ones on the title page, others may be added based on merit.
*/
div.titlepage .authorgroup,
div.titlepage .author,
div.titlepage .collab,
div.titlepage .corpauthor,
div.titlepage .corpcredit,
div.titlepage .editor,
div.titlepage .othercredit {
text-align: center;
margin-bottom: 0.25em;
}
/*
* Selection: the affiliation of various types of authors and collaborators,
* individuals or corporate.
*/
div.titlepage .affiliation {
text-align: center;
}
/*
* Selection: product release information (X Version 11, Release 7)
*
* The releaseinfo element can be contained inside a lot of different parent
* types where it might not be centered.
* We specify here the one on the title page, others may be added based on merit.
*/
div.titlepage p.releaseinfo {
font-weight: bold;
text-align: center;
}
/*
* Selection: publishing date
*/
div.titlepage .pubdate {
text-align: center;
}
/*
* The legal notices are displayed in smaller sized fonts
* Justification is only supported in IE and therefore not requested.
*
*/
.legalnotice {
font-size: small;
font-style: italic;
}
/*
* For documentation having multiple licenses, the copyright and legalnotice
* elements sequence cannot instantiated multiple times.
* The copyright notice and license text are therefore coded inside a legalnotice
* element. The role attribute on the paragraph is used to allow styling of the
* copyright notice text which should not be italicized.
*/
p.multiLicensing {
font-style: normal;
font-size: medium;
}
/*
* Selection: book or article main ToC title
* A paragraph is generated for the title rather than a level 2 heading.
* We do not want to select chapters sub table of contents, only the main one
*/
div.book>div.toc>p,
div.article>div.toc>p {
font-size: 1.5em;
text-align: center;
}
/*
* Selection: major sections of a book or an article
*
* Unlike books, articles do not have a titlepage element for appendix.
* Using the selector "div.titlepage h2.title" would be too general.
*/
div.book>div.preface>div.titlepage h2.title,
div.book>div.chapter>div.titlepage h2.title,
div.article>div.sect1>div.titlepage h2.title,
div.article>div.section>div.titlepage h2.title,
div.book>div.appendix>div.titlepage h2.title,
div.article>div.appendix h2.title,
div.glossary>div.titlepage h2.title,
div.index>div.titlepage h2.title,
div.bibliography>div.titlepage h2.title {
/* Add a border top over the major parts, just like printed books */
/* The Gray color is already used for the ruler over the main ToC. */
border-top-style: solid;
border-top-width: 2px;
border-top-color: Gray;
/* Put some space between the border and the title */
padding-top: 0.2em;
text-align: center;
}
/*
* A Screen is a verbatim environment for displaying text that the user might
* see on a computer terminal. It is often used to display the results of a command.
*
* http://www.css3.info/preview/rounded-border/
*/
.screen {
background: #e0ffff;
border-width: 1px;
border-style: solid;
border-color: #B0C4DE;
border-radius: 1.0em;
/* Browser's vendor properties prior to CSS 3 */
-moz-border-radius: 1.0em;
-webkit-border-radius: 1.0em;
-khtml-border-radius: 1.0em;
margin-left: 1.0em;
margin-right: 1.0em;
padding: 0.5em;
}
/*
* Emphasis program listings with a light shade of gray similar to what
* DocBook XSL guide does: http://www.sagehill.net/docbookxsl/ProgramListings.html
* Found many C API docs on the web using like shades of gray.
*/
.programlisting {
background: #F4F4F4;
border-width: 1px;
border-style: solid;
border-color: Gray;
padding: 0.5em;
}
/*
* Emphasis functions synopsis using a darker shade of gray.
* Add a border such that it stands out more.
* Set the padding so the text does not touch the border.
*/
.funcsynopsis, .synopsis {
background: #e6e6fa;
border-width: 1px;
border-style: solid;
border-color: Gray;
clear: both;
margin: 0.5em;
padding: 0.25em;
}
/*
* Selection: paragraphs inside synopsis
*
* Removes the default browser margin, let the container set the padding.
* Paragraphs are not always used in synopsis
*/
.funcsynopsis p,
.synopsis p {
margin: 0;
padding: 0;
}
/*
* Selection: variable lists, informal tables and tables
*
* Note the parameter name "variablelist.as.table" in xorg-xhtml.xsl
* A table with rows and columns is constructed inside div.variablelist
*
* Set the left margin so it is indented to the right
* Display informal tables with single line borders
*/
table {
margin-left: 0.5em;
border-collapse: collapse;
}
/*
* Selection: paragraphs inside tables
*
* Removes the default browser margin, let the container set the padding.
* Paragraphs are not always used in tables
*/
td p {
margin: 0;
padding: 0;
}
/*
* Add some space between the left and right column.
* The vertical alignment helps the reader associate a term
* with a multi-line definition.
*/
td, th {
padding-left: 1.0em;
padding-right: 1.0em;
vertical-align: top;
}
.warning {
border: 1px solid red;
background: #FFFF66;
padding-left: 0.5em;
}
</style></head><body><div xml:lang="en" class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="intrinsics"></a>X Toolkit Intrinsics - C Language Interface</h1></div><div><h2 class="subtitle">X Window System</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Joel</span> <span class="surname">McCormack</span></h3><div class="affiliation"><span class="orgname">Digital Equipment Corporation<br /></span> <span class="orgdiv">Western Software Laboratory<br /></span></div></div><div class="author"><h3 class="author"><span class="firstname">Paul</span> <span class="surname">Asente</span></h3><div class="affiliation"><span class="orgname">Digital Equipment Corporation<br /></span> <span class="orgdiv">Western Software Laboratory<br /></span></div></div><div class="author"><h3 class="author"><span class="firstname">Ralph</span> <span class="othername">R.</span> <span class="surname">Swick</span></h3><div class="affiliation"><span class="orgname">Digital Equipment Corporation<br /></span> <span class="orgdiv">External Research Group<br /></span></div></div></div></div><div><p class="releaseinfo">X Version 11, Release 7.7</p></div><div><div class="legalnotice"><a id="idp44104032"></a><p>XWindow System is a trademark of X Consortium, Inc.</p><p class="multiLicensing">
Copyright © 1985, 1986, 1987, 1988, 1991, 1994 X Consortium
</p><p>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
</p><p>
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
</p><p> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
</p><p>
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
</p></div></div><div><div class="legalnotice"><a id="idp43066032"></a><p class="multiLicensing">
Copyright © 1985, 1986, 1987, 1988, 1991, 1994
Digital Equipment Corporation, Maynard, Massachusetts.
</p><p>
Permission to use, copy, modify and distribute this documentation for any
purpose and without fee is hereby granted, provided that the above copyright
notice appears in all copies and that both that copyright notice and this
permission notice appear in supporting documentation, and that the name of
Digital not be used in in advertising or publicity pertaining
to distribution of the software without specific, written prior permission.
Digital makes no representations about the suitability of the
software described herein for any purpose.
It is provided "as is" without express or implied warranty.
</p></div></div></div><hr /></div><div class="dedication"><div class="titlepage"><div><div><h1 class="title"><a id="idp12878800"></a>Acknowledgments</h1></div></div></div><p>
The design of the X11 Intrinsics was done primarily by Joel McCormack
of Digital WSL. Major contributions to the design and implementation
also were done by Charles Haynes, Mike Chow, and Paul Asente of Digital
WSL. Additional contributors to the design and/or implementation were:
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Loretta Guarino-Reid (Digital WSL)</td><td>Rich Hyde (Digital WSL)</td></tr><tr><td>Susan Angebranndt (Digital WSL)</td><td>Terry Weissman (Digital WSL)</td></tr><tr><td>Mary Larson (Digital UEG)</td><td>Mark Manasse (Digital SRC)</td></tr><tr><td>Jim Gettys (Digital SRC)</td><td>Leo Treggiari (Digital SDT)</td></tr><tr><td>Ralph Swick (Project Athena and Digital ERP)</td><td>Mark Ackerman (Project Athena)</td></tr><tr><td>Ron Newman (Project Athena)</td><td>Bob Scheifler (MIT LCS)</td></tr></tbody></table></div><p>
</p><p>
The contributors to the X10 toolkit also deserve mention. Although the X11 Intrinsics present an
entirely different programming style, they borrow heavily from the implicit and
explicit concepts in the X10 toolkit.
</p><p>
The design and implementation of the X10 Intrinsics were done by:
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col /></colgroup><tbody><tr><td>Terry Weissman (Digital WSL)</td></tr><tr><td>Smokey Wallace (Digital WSL)</td></tr><tr><td>Phil Karlton (Digital WSL)</td></tr><tr><td>Charles Haynes (Digital WSL)</td></tr><tr><td>Frank Hall (HP)</td></tr></tbody></table></div><p>
</p><p>
The design and implementation of the X10 toolkit’s sample widgets were by
the above, as well as by:
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col /></colgroup><tbody><tr><td>Ram Rao (Digital UEG)</td></tr><tr><td>Mary Larson (Digital UEG)</td></tr><tr><td>Mike Gancarz (Digital UEG)</td></tr><tr><td>Kathleen Langone (Digital UEG)</td></tr></tbody></table></div><p>
</p><p>
These widgets provided a checklist of requirements that we had to address in the X11 Intrinsics.
</p><p>
Thanks go to Al Mento of Digital’s UEG Documentation Group for formatting and generally
improving this document and to John Ousterhout of Berkeley for extensively reviewing early
drafts of it.
</p><p>
Finally, a special thanks to Mike Chow, whose extensive performance analysis of the X10 toolkit
provided the justification to redesign it entirely for X11.
</p><div class="literallayout"><p><br />
Joel McCormack<br />
Western Software Laboratory<br />
Digital Equipment Corporation<br />
March 1988<br />
</p></div><p>
The current design of the Intrinsics has benefited greatly from the
input of several dedicated reviewers in the membership of the X
Consortium. In addition to those already mentioned, the following
individuals have dedicated significant time to suggesting improvements
to the Intrinsics:
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Steve Pitschke (Stellar)</td><td>C.Doug Blewett (AT&T)</td></tr><tr><td>Bob Miller (HP)</td><td>David Schiferl (Tektronix)</td></tr><tr><td>Fred Taft (HP)</td><td>Michael Squires (Sequent)</td></tr><tr><td>Marcel Meth (AT&T)</td><td>JimFulton (MIT)</td></tr><tr><td>Mike Collins (Digital)</td><td>Kerry Kimbrough (Texas Instruments)</td></tr><tr><td>Scott McGregor (Digital)</td><td>Phil Karlton (Digital)</td></tr><tr><td>Julian Payne (ESS)</td><td>Jacques Davy (Bull)</td></tr><tr><td>Gabriel Beged-Dov (HP)</td><td>GlennWidener (Tektronix)</td></tr></tbody></table></div><p>
</p><p>
Thanks go to each of them for the countless hours spent reviewing drafts and code.
</p><div class="literallayout"><p><br />
Ralph R. Swick<br />
External Research Group<br />
Digital Equipment Corporation<br />
MIT Project Athena<br />
June 1988<br />
</p></div><p>
From Release 3 to Release 4, several new members joined the design team. We greatly appreciate
the thoughtful comments, suggestions, lengthy discussions, and in some cases implementation
code contributed by each of the following:
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Don Alecci (AT&T)</td><td>EllisCohen (OSF)</td></tr><tr><td>Donna Converse (MIT)</td><td>Clive Feather (IXI)</td></tr><tr><td>Nayeem Islam (Sun)</td><td>Dana Laursen (HP)</td></tr><tr><td>Keith Packard (MIT)</td><td>Chris Peterson (MIT)</td></tr><tr><td>Richard Probst (Sun)</td><td>Larry Cable (Sun)</td></tr></tbody></table></div><p>
</p><p>
In Release 5, the effort to define the internationalization additions was headed by Bill McMahon
of Hewlett Packard and Frank Rojas of IBM. This has been an educational process for many of
us, and Bill and Frank’s tutelage has carried us through. Vania Joloboff of the OSF also contributed
to the internationalization additions. The implementation efforts of Bill, Gabe Beged-Dov,
and especially Donna Converse for this release are also gratefully acknowledged.
</p><div class="literallayout"><p><br />
Ralph R. Swick<br />
December 1989<br />
and<br />
July 1991<br />
</p></div><p>
The Release 6 Intrinsics is a result of the collaborative efforts of participants in the X Consortium’s
intrinsics working group. A few individuals contributed substantial design proposals, participated
in lengthy discussions, reviewed final specifications, and in most cases, were also
responsible for sections of the implementation. They deserve recognition and thanks for their
major contributions:
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Paul Asente (Adobe)</td><td>Larry Cable (SunSoft)</td></tr><tr><td>Ellis Cohen (OSF)</td><td>Daniel Dardailler (OSF)</td></tr><tr><td>Vania Joloboff (OSF)</td><td>KalebKeithley (X Consortium)</td></tr><tr><td>Courtney Loomis (HP)</td><td>Douglas Rand (OSF)</td></tr><tr><td>Bob Scheifler (X Consortium)</td><td>Ajay Vohra (SunSoft)</td></tr></tbody></table></div><p>
</p><p>
Many others analyzed designs, offered useful comments and suggestions, and participated in a
significant subset of the process. The following people deserve thanks for their contributions:
Andy Bovingdon, Sam Chang, Chris Craig, George Erwin-Grotsky, Keith Edwards, Clive
Feather, Stephen Gildea, Dan Heller, Steve Humphrey, David Kaelbling, Jaime Lau, Rob Lembree,
Stuart Marks, Beth Mynatt, Tom Paquin, Chris Peterson, Kamesh Ramakrishna, Tom
Rodriguez, Jim VanGilder, Will Walker, and Mike Wexler.
</p><p>
I am especially grateful to two of my colleagues: Ralph Swick for expert editorial guidance, and
Kaleb Keithley for leadership in the implementation and the specification work.
</p><div class="literallayout"><p><br />
Donna Converse<br />
X Consortium<br />
April 1994<br />
</p></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="preface"><a href="#About_This_Manual">About This Manual</a></span></dt><dt><span class="chapter"><a href="#Intrinsics_and_Widgets">1. Intrinsics and Widgets</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Intrinsics">Intrinsics</a></span></dt><dt><span class="sect1"><a href="#Languages">Languages</a></span></dt><dt><span class="sect1"><a href="#Procedures_and_Macros">Procedures and Macros</a></span></dt><dt><span class="sect1"><a href="#Widgets">Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Core_Widgets">Core Widgets</a></span></dt><dt><span class="sect2"><a href="#Composite_Widgets">Composite Widgets</a></span></dt><dt><span class="sect2"><a href="#Constraint_Widgets">Constraint Widgets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Implementation_Specific_Types">Implementation-Specific Types</a></span></dt><dt><span class="sect1"><a href="#Widget_Classing">Widget Classing</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Widget_Naming_Conventions">Widget Naming Conventions</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclassing_in_Public_h_Files">Widget Subclassing in Public .h Files</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclassing_in_Private_h_Files">Widget Subclassing in Private .h Files</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclassing_in_c_Files">Widget Subclassing in .c Files</a></span></dt><dt><span class="sect2"><a href="#Widget_Class_and_Superclass_Look_Up">Widget Class and Superclass Look Up</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclass_Verification">Widget Subclass Verification</a></span></dt><dt><span class="sect2"><a href="#Superclass_Chaining">Superclass Chaining</a></span></dt><dt><span class="sect2"><a href="#Class_Initialization_class_initialize_and_class_part_initialize_Procedures">Class Initialization: class_initialize and class_part_initialize Procedures</a></span></dt><dt><span class="sect2"><a href="#Initializing_a_Widget_Class">Initializing a Widget Class</a></span></dt><dt><span class="sect2"><a href="#Inheritance_of_Superclass_Operations">Inheritance of Superclass Operations</a></span></dt><dt><span class="sect2"><a href="#Invocation_of_Superclass_Operations">Invocation of Superclass Operations</a></span></dt><dt><span class="sect2"><a href="#Class_Extension_Records">Class Extension Records</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Widget_Instantiation">2. Widget Instantiation</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Initializing_the_tk">Initializing the X Toolkit</a></span></dt><dt><span class="sect1"><a href="#Establishing_the_Locale">Establishing the Locale</a></span></dt><dt><span class="sect1"><a href="#Loading_the_Resource_Database">Loading the Resource Database</a></span></dt><dt><span class="sect1"><a href="#Parsing_the_Command_Line">Parsing the Command Line</a></span></dt><dt><span class="sect1"><a href="#Creating_Widgets">Creating Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Creating_and_Merging_Argument_Lists">Creating and Merging Argument Lists</a></span></dt><dt><span class="sect2"><a href="#Creating_a_Widget_Instance">Creating a Widget Instance</a></span></dt><dt><span class="sect2"><a href="#Creating_an_Application_Shell_Instance">Creating an Application Shell Instance</a></span></dt><dt><span class="sect2"><a href="#Convenience_Procedure_to_Initialize_an_Application">Convenience Procedure to Initialize an Application</a></span></dt><dt><span class="sect2"><a href="#Widget_Instance_Allocation_The_allocate_Procedure">Widget Instance Allocation: The allocate Procedure</a></span></dt><dt><span class="sect2"><a href="#Widget_Instance_Initialization_The_initialize_Procedure">Widget Instance Initialization: The initialize Procedure</a></span></dt><dt><span class="sect2"><a href="#Constraint_Instance_Initialization_The_ConstraintClassPart_initialize_Procedure">Constraint Instance Initialization: The ConstraintClassPart initialize Procedure</a></span></dt><dt><span class="sect2"><a href="#Nonwidget_Data_Initialization_The_initialize_hook_Procedure">Nonwidget Data Initialization: The initialize_hook Procedure</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Realizing_Widgets">Realizing Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Widget_Instance_Window_Creation_The_realize_Procedure">Widget Instance Window Creation: The realize Procedure</a></span></dt><dt><span class="sect2"><a href="#Window_Creation_Convenience_Routine">Window Creation Convenience Routine</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Obtaining_Window_Information_from_a_Widget">Obtaining Window Information from a Widget</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Unrealizing_Widgets">Unrealizing Widgets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Destroying_Widgets">Destroying Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Adding_and_Removing_Destroy_Callbacks">Adding and Removing Destroy Callbacks</a></span></dt><dt><span class="sect2"><a href="#Dynamic_Data_Deallocation_The_destroy_Procedure">Dynamic Data Deallocation: The destroy Procedure</a></span></dt><dt><span class="sect2"><a href="#Dynamic_Constraint_Data_Deallocation_The_ConstraintClassPart_destroy_Procedure">Dynamic Constraint Data Deallocation: The ConstraintClassPart destroy Procedure</a></span></dt><dt><span class="sect2"><a href="#Widget_Instance_Deallocation_The_deallocate_Procedure">Widget Instance Deallocation: The deallocate Procedure</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Exiting_from_an_Application">Exiting from an Application</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Composite_Widgets_and_Their_Children">3. Composite Widgets and Their Children</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Addition_of_Children_to_a_Composite_Widget_The_insert_child_Procedure">Addition of Children to a Composite Widget: The insert_child Procedure</a></span></dt><dt><span class="sect1"><a href="#Insertion_Order_of_Children_The_insert_position_Procedure">Insertion Order of Children: The insert_position Procedure</a></span></dt><dt><span class="sect1"><a href="#Deletion_of_Children_The_delete_child_Procedure">Deletion of Children: The delete_child Procedure</a></span></dt><dt><span class="sect1"><a href="#Adding_and_Removing_Children_from_the_Managed_Set">Adding and Removing Children from the Managed Set</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Managing_Children">Managing Children</a></span></dt><dt><span class="sect2"><a href="#Unmanaging_Children">Unmanaging Children</a></span></dt><dt><span class="sect2"><a href="#Bundling_Changes_to_the_Managed_Set">Bundling Changes to the Managed Set</a></span></dt><dt><span class="sect2"><a href="#Determining_if_a_Widget_Is_Managed">Determining if a Widget Is Managed</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Controlling_When_Widgets_Get_Mapped">Controlling When Widgets Get Mapped</a></span></dt><dt><span class="sect1"><a href="#Constrained_Composite_Widgets">Constrained Composite Widgets</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Shell_Widgets">4. Shell Widgets</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Shell_Widget_Definitions">Shell Widget Definitions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#ShellClassPart_Definitions">ShellClassPart Definitions</a></span></dt><dt><span class="sect2"><a href="#ShellPart_Definition">ShellPart Definition</a></span></dt><dt><span class="sect2"><a href="#Shell_Resources">Shell Resources</a></span></dt><dt><span class="sect2"><a href="#ShellPart_Default_Values">ShellPart Default Values</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Session_Participation">Session Participation</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Joining_a_Session">Joining a Session</a></span></dt><dt><span class="sect2"><a href="#Saving_Application_State">Saving Application State</a></span></dt><dt><span class="sect2"><a href="#Responding_to_a_Shutdown">Responding to a Shutdown</a></span></dt><dt><span class="sect2"><a href="#Resigning_from_a_Session">Resigning from a Session</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Pop_Up_Widgets">5. Pop-Up Widgets</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Pop_Up_Widget_Types">Pop-Up Widget Types</a></span></dt><dt><span class="sect1"><a href="#Creating_a_Pop_Up_Shell">Creating a Pop-Up Shell</a></span></dt><dt><span class="sect1"><a href="#Creating_Pop_Up_Children">Creating Pop-Up Children</a></span></dt><dt><span class="sect1"><a href="#Mapping_a_Pop_Up_Widget">Mapping a Pop-Up Widget</a></span></dt><dt><span class="sect1"><a href="#Unmapping_a_Pop_Up_Widget">Unmapping a Pop-Up Widget</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Geometry_Management">6. Geometry Management</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Initiating_Geometry_Changes">Initiating Geometry Changes</a></span></dt><dt><span class="sect1"><a href="#General_Geometry_Manager_Requests">General Geometry Manager Requests</a></span></dt><dt><span class="sect1"><a href="#Resize_Requests">Resize Requests</a></span></dt><dt><span class="sect1"><a href="#Potential_Geometry_Changes">Potential Geometry Changes</a></span></dt><dt><span class="sect1"><a href="#Child_Geometry_Management_The_geometry_manager_Procedure">Child Geometry Management: The geometry_manager Procedure</a></span></dt><dt><span class="sect1"><a href="#Widget_Placement_and_Sizing">Widget Placement and Sizing</a></span></dt><dt><span class="sect1"><a href="#Preferred_Geometry">Preferred Geometry</a></span></dt><dt><span class="sect1"><a href="#Size_Change_Management_The_resize_Procedure">Size Change Management: The resize Procedure</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Event_Management">7. Event Management</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Adding_and_Deleting_Additional_Event_Sources">Adding and Deleting Additional Event Sources</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Adding_and_Removing_Input_Sources">Adding and Removing Input Sources</a></span></dt><dt><span class="sect2"><a href="#Adding_and_Removing_Blocking_Notifications">Adding and Removing Blocking Notifications</a></span></dt><dt><span class="sect2"><a href="#Adding_and_Removing_Timeouts">Adding and Removing Timeouts</a></span></dt><dt><span class="sect2"><a href="#Adding_and_Removing_Signal_Callbacks">Adding and Removing Signal Callbacks</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Constraining_Events_to_a_Cascade_of_Widgets">Constraining Events to a Cascade of Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Requesting_Key_and_Button_Grabs">Requesting Key and Button Grabs</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Focusing_Events_on_a_Child">Focusing Events on a Child</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Events_for_Drawables_That_Are_Not_a_Widget_s_Window">Events for Drawables That Are Not a Widget's Window</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Querying_Event_Sources">Querying Event Sources</a></span></dt><dt><span class="sect1"><a href="#Dispatching_Events">Dispatching Events</a></span></dt><dt><span class="sect1"><a href="#The_Application_Input_Loop">The Application Input Loop</a></span></dt><dt><span class="sect1"><a href="#Setting_and_Checking_the_Sensitivity_State_of_a_Widget">Setting and Checking the Sensitivity State of a Widget</a></span></dt><dt><span class="sect1"><a href="#Adding_Background_Work_Procedures">Adding Background Work Procedures</a></span></dt><dt><span class="sect1"><a href="#X_Event_Filters">X Event Filters</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Pointer_Motion_Compression">Pointer Motion Compression</a></span></dt><dt><span class="sect2"><a href="#Enter_Leave_Compression">Enter/Leave Compression</a></span></dt><dt><span class="sect2"><a href="#Exposure_Compression">Exposure Compression</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Widget_Exposure_and_Visibility">Widget Exposure and Visibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Redisplay_of_a_Widget_The_expose_Procedure">Redisplay of a Widget: The expose Procedure</a></span></dt><dt><span class="sect2"><a href="#Widget_Visibility">Widget Visibility</a></span></dt></dl></dd><dt><span class="sect1"><a href="#X_Event_Handlers">X Event Handlers</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Event_Handlers_That_Select_Events">Event Handlers That Select Events</a></span></dt><dt><span class="sect2"><a href="#Event_Handlers_That_Do_Not_Select_Events">Event Handlers That Do Not Select Events</a></span></dt><dt><span class="sect2"><a href="#Current_Event_Mask">Current Event Mask</a></span></dt><dt><span class="sect2"><a href="#Event_Handlers_for_X_Protocol_Extensions">Event Handlers for X11 Protocol Extensions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Using_the_Intrinsics_in_a_Multi_Threaded_Environment">Using the Intrinsics in a Multi-Threaded Environment</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Initializing_a_Multi_Threaded_Intrinsics_Application">Initializing a Multi-Threaded Intrinsics Application</a></span></dt><dt><span class="sect2"><a href="#Locking_tk_Data_Structures">Locking X Toolkit Data Structures</a></span></dt><dt><span class="sect2"><a href="#Event_Management_in_a_Multi_Threaded_Environment">Event Management in a Multi-Threaded Environment</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Callbacks">8. Callbacks</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Using_Callback_Procedure_and_Callback_List_Definitions">Using Callback Procedure and Callback List Definitions</a></span></dt><dt><span class="sect1"><a href="#Identifying_Callback_Lists">Identifying Callback Lists</a></span></dt><dt><span class="sect1"><a href="#Adding_Callback_Procedures">Adding Callback Procedures</a></span></dt><dt><span class="sect1"><a href="#Removing_Callback_Procedures">Removing Callback Procedures</a></span></dt><dt><span class="sect1"><a href="#Executing_Callback_Procedures">Executing Callback Procedures</a></span></dt><dt><span class="sect1"><a href="#Checking_the_Status_of_a_Callback_List">Checking the Status of a Callback List</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Resource_Management">9. Resource Management</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Resource_Lists">Resource Lists</a></span></dt><dt><span class="sect1"><a href="#Byte_Offset_Calculations">Byte Offset Calculations</a></span></dt><dt><span class="sect1"><a href="#Superclass_to_Subclass_Chaining_of_Resource_Lists">Superclass-to-Subclass Chaining of Resource Lists</a></span></dt><dt><span class="sect1"><a href="#Subresources">Subresources</a></span></dt><dt><span class="sect1"><a href="#Obtaining_Application_Resources">Obtaining Application Resources</a></span></dt><dt><span class="sect1"><a href="#Resource_Conversions">Resource Conversions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Predefined_Resource_Converters">Predefined Resource Converters</a></span></dt><dt><span class="sect2"><a href="#New_Resource_Converters">New Resource Converters</a></span></dt><dt><span class="sect2"><a href="#Issuing_Conversion_Warnings">Issuing Conversion Warnings</a></span></dt><dt><span class="sect2"><a href="#Registering_a_New_Resource_Converter">Registering a New Resource Converter</a></span></dt><dt><span class="sect2"><a href="#Resource_Converter_Invocation">Resource Converter Invocation</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Reading_and_Writing_Widget_State">Reading and Writing Widget State</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Obtaining_Widget_State">Obtaining Widget State</a></span></dt><dt><span class="sect2"><a href="#Setting_Widget_State">Setting Widget State</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Translation_Management">10. Translation Management</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Action_Tables">Action Tables</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Action_Table_Registration">Action Table Registration</a></span></dt><dt><span class="sect2"><a href="#Action_Names_to_Procedure_Translations">Action Names to Procedure Translations</a></span></dt><dt><span class="sect2"><a href="#Action_Hook_Registration">Action Hook Registration</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Translation_Tables">Translation Tables</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Event_Sequences">Event Sequences</a></span></dt><dt><span class="sect2"><a href="#Action_Sequences">Action Sequences</a></span></dt><dt><span class="sect2"><a href="#Multi_Click_Time">Multi-Click Time</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Translation_Table_Management">Translation Table Management</a></span></dt><dt><span class="sect1"><a href="#Using_Accelerators">Using Accelerators</a></span></dt><dt><span class="sect1"><a href="#KeyCode_to_KeySym_Conversions">KeyCode-to-KeySym Conversions</a></span></dt><dt><span class="sect1"><a href="#Obtaining_a_KeySym_in_an_Action_Procedure">Obtaining a KeySym in an Action Procedure</a></span></dt><dt><span class="sect1"><a href="#KeySym_to_KeyCode_Conversions">KeySym-to-KeyCode Conversions</a></span></dt><dt><span class="sect1"><a href="#Registering_Button_and_Key_Grabs_for_Actions">Registering Button and Key Grabs for Actions</a></span></dt><dt><span class="sect1"><a href="#Invoking_Actions_Directly">Invoking Actions Directly</a></span></dt><dt><span class="sect1"><a href="#Obtaining_a_Widget_s_Action_List">Obtaining a Widget's Action List</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Utility_Functions">11. Utility Functions</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Determining_the_Number_of_Elements_in_an_Array">Determining the Number of Elements in an Array</a></span></dt><dt><span class="sect1"><a href="#Translating_Strings_to_Widget_Instances">Translating Strings to Widget Instances</a></span></dt><dt><span class="sect1"><a href="#Managing_Memory_Usage">Managing Memory Usage</a></span></dt><dt><span class="sect1"><a href="#Sharing_Graphics_Contexts">Sharing Graphics Contexts</a></span></dt><dt><span class="sect1"><a href="#Managing_Selections">Managing Selections</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Setting_and_Getting_the_Selection_Timeout_Value">Setting and Getting the Selection Timeout Value</a></span></dt><dt><span class="sect2"><a href="#Using_Atomic_Transfers">Using Atomic Transfers</a></span></dt><dt><span class="sect2"><a href="#Using_Incremental_Transfers">Using Incremental Transfers</a></span></dt><dt><span class="sect2"><a href="#Setting_and_Retrieving_Selection_Target_Parameters">Setting and Retrieving Selection Target Parameters</a></span></dt><dt><span class="sect2"><a href="#Generating_MULTIPLE_Requests">Generating MULTIPLE Requests</a></span></dt><dt><span class="sect2"><a href="#Auxiliary_Selection_Properties">Auxiliary Selection Properties</a></span></dt><dt><span class="sect2"><a href="#Retrieving_the_Most_Recent_Timestamp">Retrieving the Most Recent Timestamp</a></span></dt><dt><span class="sect2"><a href="#Retrieving_the_Most_Recent_Event">Retrieving the Most Recent Event</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Merging_Exposure_Events_into_a_Region">Merging Exposure Events into a Region</a></span></dt><dt><span class="sect1"><a href="#Translating_Widget_Coordinates">Translating Widget Coordinates</a></span></dt><dt><span class="sect1"><a href="#Translating_a_Window_to_a_Widget">Translating a Window to a Widget</a></span></dt><dt><span class="sect1"><a href="#Handling_Errors">Handling Errors</a></span></dt><dt><span class="sect1"><a href="#Setting_WM_COLORMAP_WINDOWS">Setting WM_COLORMAP_WINDOWS</a></span></dt><dt><span class="sect1"><a href="#Finding_File_Names">Finding File Names</a></span></dt><dt><span class="sect1"><a href="#Hooks_for_External_Agents">Hooks for External Agents</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Hook_Object_Resources">Hook Object Resources</a></span></dt><dt><span class="sect2"><a href="#Querying_Open_Displays">Querying Open Displays</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Nonwidget_Objects">12. Nonwidget Objects</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Data_Structures">Data Structures</a></span></dt><dt><span class="sect1"><a href="#Object_Objects">Object Objects</a></span></dt><dd><dl><dt><span class="sect2"><a href="#ObjectClassPart_Structure">ObjectClassPart Structure</a></span></dt><dt><span class="sect2"><a href="#ObjectPart_Structure">ObjectPart Structure</a></span></dt><dt><span class="sect2"><a href="#Object_Resources">Object Resources</a></span></dt><dt><span class="sect2"><a href="#ObjectPart_Default_Values">ObjectPart Default Values</a></span></dt><dt><span class="sect2"><a href="#Object_Arguments_to_xI_Routines">Object Arguments to Intrinsics Routines</a></span></dt><dt><span class="sect2"><a href="#Use_of_Objects">Use of Objects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Rectangle_Objects">Rectangle Objects</a></span></dt><dd><dl><dt><span class="sect2"><a href="#RectObjClassPart_Structure">RectObjClassPart Structure</a></span></dt><dt><span class="sect2"><a href="#RectObjPart_Structure">RectObjPart Structure</a></span></dt><dt><span class="sect2"><a href="#RectObj_Resources">RectObj Resources</a></span></dt><dt><span class="sect2"><a href="#RectObjPart_Default_Values">RectObjPart Default Values</a></span></dt><dt><span class="sect2"><a href="#Widget_Arguments_to_xI_Routines">Widget Arguments to Intrinsics Routines</a></span></dt><dt><span class="sect2"><a href="#Use_of_Rectangle_Objects">Use of Rectangle Objects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Undeclared_Class">Undeclared Class</a></span></dt><dt><span class="sect1"><a href="#Widget_Arguments_to_Intrinsics_Routines">Widget Arguments to Intrinsics Routines</a></span></dt></dl></dd><dt><span class="chapter"><a href="#Evolution_of_the_Intrinsics">13. Evolution of the Intrinsics</a></span></dt><dd><dl><dt><span class="sect1"><a href="#Determining_Specification_Revision_Level">Determining Specification Revision Level</a></span></dt><dt><span class="sect1"><a href="#Release_to_Release_Compatibility">Release 3 to Release 4 Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Additional_Arguments">Additional Arguments</a></span></dt><dt><span class="sect2"><a href="#set_values_almost_Procedures">set_values_almost Procedures</a></span></dt><dt><span class="sect2"><a href="#Query_Geometry">Query Geometry</a></span></dt><dt><span class="sect2"><a href="#unrealizeCallback_Callback_List">unrealizeCallback Callback List</a></span></dt><dt><span class="sect2"><a href="#Subclasses_of_WMShell">Subclasses of WMShell</a></span></dt><dt><span class="sect2"><a href="#Resource_Type_Converters">Resource Type Converters</a></span></dt><dt><span class="sect2"><a href="#KeySym_Case_Conversion_Procedure">KeySym Case Conversion Procedure</a></span></dt><dt><span class="sect2"><a href="#Nonwidget_Objects_2">Nonwidget Objects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Release_to_Release_Compatibility_2">Release 4 to Release 5 Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#baseTranslations_Resource">baseTranslations Resource</a></span></dt><dt><span class="sect2"><a href="#Resource_File_Search_Path">Resource File Search Path</a></span></dt><dt><span class="sect2"><a href="#Customization_Resource">Customization Resource</a></span></dt><dt><span class="sect2"><a href="#Per_Screen_Resource_Database">Per-Screen Resource Database</a></span></dt><dt><span class="sect2"><a href="#Internationalization_of_Applications">Internationalization of Applications</a></span></dt><dt><span class="sect2"><a href="#Permanently_Allocated_Strings">Permanently Allocated Strings</a></span></dt><dt><span class="sect2"><a href="#Arguments_to_Existing_Functions">Arguments to Existing Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Release_to_Release_Compatibility_3">Release 5 to Release 6 Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Widget_Internals">Widget Internals</a></span></dt><dt><span class="sect2"><a href="#General_Application_Development">General Application Development</a></span></dt><dt><span class="sect2"><a href="#Communication_with_Window_and_Session_Managers">Communication with Window and Session Managers</a></span></dt><dt><span class="sect2"><a href="#Geometry_Management_2">Geometry Management</a></span></dt><dt><span class="sect2"><a href="#Event_Management_2">Event Management</a></span></dt><dt><span class="sect2"><a href="#Resource_Management_2">Resource Management</a></span></dt><dt><span class="sect2"><a href="#Translation_Management_2">Translation Management</a></span></dt><dt><span class="sect2"><a href="#Selections">Selections</a></span></dt><dt><span class="sect2"><a href="#External_Agent_Hooks">External Agent Hooks</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="#Resource_File_Format">A. Resource File Format</a></span></dt><dt><span class="appendix"><a href="#Translation_Table_Syntax">B. Translation Table Syntax</a></span></dt><dt><span class="appendix"><a href="#Compability_Functions">C. Compatibility Functions
</a></span></dt><dt><span class="appendix"><a href="#Intrinsics_Error_Messages">D. Intrinsics Error Messages</a></span></dt><dt><span class="appendix"><a href="#Defined_Strings">E. Defined Strings</a></span></dt><dt><span class="appendix"><a href="#Resource_Configuration_Management">F. Resource Configuration Management</a></span></dt></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="About_This_Manual"></a>About This Manual</h1></div></div></div><p>
X Toolkit Intrinsics — C Language Interface is intended to be read by both application programmers
who will use one or more of the many widget sets built with the Intrinsics and by widget
programmers who will use the Intrinsics to build widgets for one of the widget sets. Not all the
information in this manual, however, applies to both audiences. That is, because the application
programmer is likely to use only a number of the Intrinsics functions in writing an application and
because the widget programmer is likely to use many more, if not all, of the Intrinsics functions
in building a widget, an attempt has been made to highlight those areas of information that are
deemed to be of special interest for the application programmer. (It is assumed the widget programmer
will have to be familiar with all the information.) Therefore, all entries in the table of
contents that are printed in <span class="strong"><strong>bold</strong></span> indicate the information that
should be of special interest to an application programmer.
</p><p>
It is also assumed that, as application programmers become more familiar with the concepts discussed
in this manual, they will find it more convenient to implement portions of their applications
as special-purpose or custom widgets. It is possible, nonetheless, to use widgets without
knowing how to build them.
</p><h2><a id="idp44822720"></a><span class="strong"><strong>Conventions Used in this Manual</strong></span></h2><p>This document uses the following conventions:</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Global symbols are printed in <code class="function">this special font</code>. These can be either
function names, symbols defined in include files, data types, or structure names. Arguments to
functions, procedures, or macros are printed in italics.
</p></li><li class="listitem"><p>
Each function is introduced by a general discussion that distinguishes it from other functions.
The function declaration itself follows, and each argument is specifically explained.
General discussion of the function, if any is required, follows the arguments.
</p></li><li class="listitem"><p>
To eliminate any ambiguity between those arguments that you pass and those that a function
returns to you, the explanations for all arguments that you pass start with the word
specifies or, in the case of multiple arguments, the word specify. The explanations for all
arguments that are returned to you start with the word <span class="emphasis"><em>returns</em></span> or, in
the case of multiple arguments, the word <span class="emphasis"><em>return</em></span>.
</p></li></ul></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Intrinsics_and_Widgets"></a>Chapter 1. Intrinsics and Widgets</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Intrinsics">Intrinsics</a></span></dt><dt><span class="sect1"><a href="#Languages">Languages</a></span></dt><dt><span class="sect1"><a href="#Procedures_and_Macros">Procedures and Macros</a></span></dt><dt><span class="sect1"><a href="#Widgets">Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Core_Widgets">Core Widgets</a></span></dt><dt><span class="sect2"><a href="#Composite_Widgets">Composite Widgets</a></span></dt><dt><span class="sect2"><a href="#Constraint_Widgets">Constraint Widgets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Implementation_Specific_Types">Implementation-Specific Types</a></span></dt><dt><span class="sect1"><a href="#Widget_Classing">Widget Classing</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Widget_Naming_Conventions">Widget Naming Conventions</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclassing_in_Public_h_Files">Widget Subclassing in Public .h Files</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclassing_in_Private_h_Files">Widget Subclassing in Private .h Files</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclassing_in_c_Files">Widget Subclassing in .c Files</a></span></dt><dt><span class="sect2"><a href="#Widget_Class_and_Superclass_Look_Up">Widget Class and Superclass Look Up</a></span></dt><dt><span class="sect2"><a href="#Widget_Subclass_Verification">Widget Subclass Verification</a></span></dt><dt><span class="sect2"><a href="#Superclass_Chaining">Superclass Chaining</a></span></dt><dt><span class="sect2"><a href="#Class_Initialization_class_initialize_and_class_part_initialize_Procedures">Class Initialization: class_initialize and class_part_initialize Procedures</a></span></dt><dt><span class="sect2"><a href="#Initializing_a_Widget_Class">Initializing a Widget Class</a></span></dt><dt><span class="sect2"><a href="#Inheritance_of_Superclass_Operations">Inheritance of Superclass Operations</a></span></dt><dt><span class="sect2"><a href="#Invocation_of_Superclass_Operations">Invocation of Superclass Operations</a></span></dt><dt><span class="sect2"><a href="#Class_Extension_Records">Class Extension Records</a></span></dt></dl></dd></dl></div><p>
The Intrinsics are a programming library tailored to the special requirements
of user interface construction within a network window system,
specifically the X Window System.
The Intrinsics and a widget set make up an X Toolkit.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Intrinsics"></a>Intrinsics</h2></div></div></div><p>
The Intrinsics provide the base mechanism necessary to build
a wide variety of interoperating widget sets and application environments.
The Intrinsics are a layer on top of Xlib, the
C Library X Interface. They extend the
fundamental abstractions provided by the X Window System while still
remaining independent of any particular user interface policy or
style.
</p><p>
The Intrinsics use object-oriented programming techniques to supply a
consistent architecture for constructing and composing user interface
components, known as widgets. This
allows programmers to extend a widget set in new ways, either by
deriving new widgets from existing ones (subclassing) or by writing
entirely new widgets following the established conventions.
</p><p>
When the Intrinsics were first conceived, the root of the object
hierarchy was a widget class named
Core.
In Release 4 of the
Intrinsics, three nonwidget superclasses were added above Core.
These superclasses are described in <a class="xref" href="#Nonwidget_Objects" title="Chapter 12. Nonwidget Objects">Chapter 12, <em>Nonwidget Objects</em></a>.
The name of the class
now at the root of the Intrinsics class hierarchy is
Object.
The remainder of this
specification refers uniformly to <span class="emphasis"><em>widgets</em></span> and <span class="emphasis"><em>Core</em></span>
as if they were the
base class for all Intrinsics operations. The argument descriptions
for each Intrinsics procedure and <a class="xref" href="#Nonwidget_Objects" title="Chapter 12. Nonwidget Objects">Chapter 12, <em>Nonwidget Objects</em></a>
describe which operations
are defined for the nonwidget superclasses of Core. The reader may
determine by context whether a specific reference to <span class="emphasis"><em>widget</em></span>
actually means ``widget'' or ``object.''
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Languages"></a>Languages</h2></div></div></div><p>
The Intrinsics are intended to be used for two programming purposes.
Programmers writing widgets will be using most of the facilities
provided by the
Intrinsics to construct user interface components from the simple, such
as buttons and scrollbars, to the complex, such as control panels and
property sheets. Application programmers will use a much smaller subset of
the Intrinsics procedures in combination with one or more sets of widgets to
construct and present complete user interfaces on an X display. The
Intrinsics
programming interfaces primarily
intended for application use are designed to be callable from most
procedural programming languages. Therefore, most arguments are passed by
reference rather than by value. The interfaces primarily
intended for widget programmers are expected to be used principally
from the C language. In these cases, the usual C programming
conventions apply. In this specification, the term <span class="emphasis"><em>client</em></span> refers to
any module, widget, or application that calls an Intrinsics procedure.
</p><p>
Applications that use the Intrinsics mechanisms
must include the header files
<code class="function"><X11/Intrinsic.h></code>
and
<code class="function"><X11/StringDefs.h></code>,
or their equivalent,
and they may also include
<code class="function"><X11/Xatoms.h></code>
and
<code class="function"><X11/Shell.h></code>.
In addition, widget implementations should include
<code class="function"><X11/IntrinsicP.h></code>
instead of
<code class="function"><X11/Intrinsic.h></code>.
</p><p>
The applications must also include the additional header files for
each widget class that they are to use (for example,
<code class="function"><X11/Xaw/Label.h></code>
or
<code class="function"><X11/Xaw/Scrollbar.h>).</code>
On a POSIX-based system,
the Intrinsics object library file is named
<code class="function">libXt.a</code>
and is usually referenced as \-lXt when linking the application.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Procedures_and_Macros"></a>Procedures and Macros</h2></div></div></div><p>
All functions defined in this specification except those specified below
may be implemented as C macros with arguments. C applications may use
``#undef'' to remove a macro definition and ensure that the actual function
is referenced. Any such macro will expand to a single expression that
has the same precedence as a function call and that evaluates each
of its arguments exactly once, fully protected by parentheses, so that
arbitrary expressions may be used as arguments.
</p><p>
The following symbols are macros that do not have function
equivalents and that may expand their arguments in a manner other
than that described above:
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>,
<a class="xref" href="#XtNew"><code class="function">XtNew</code></a>,
<a class="xref" href="#XtNumber"><code class="function">XtNumber</code></a>,
<a class="xref" href="#XtOffsetOf"><code class="function">XtOffsetOf</code></a>,
<a class="xref" href="#XtOffset"><code class="function">XtOffset</code></a>,
and
<a class="xref" href="#XtSetArg"><code class="function">XtSetArg</code></a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Widgets"></a>Widgets</h2></div></div></div><p>
The fundamental abstraction and data type of the X Toolkit is the widget,
which is a combination of an X window and its associated
input and display semantics
and which is dynamically allocated and contains state information.
Some widgets display information (for example, text or graphics),
and others are merely containers for other widgets (for example, a menu box).
Some widgets are output-only and do not react to pointer or keyboard input,
and others change their display in response to input
and can invoke functions that an application has attached to them.
</p><p>
Every widget belongs to exactly one widget class, which is statically
allocated and initialized and which contains the operations allowable on
widgets of that class.
Logically, a widget class is the procedures and data associated
with all widgets belonging to that class.
These procedures and data can be inherited by
subclasses.
Physically, a widget class is a pointer to a structure.
The contents of this structure are constant for all widgets of the widget
class but will vary from class to class.
(Here, ``constant'' means the class structure is initialized at compile time
and never changed, except for a one-time class initialization
and in-place compilation of resource lists,
which takes place when the first widget of the class or subclass is created.)
For further information,
see <a class="xref" href="#Creating_Widgets" title="Creating Widgets">the section called “Creating Widgets”</a>
</p><p>
The distribution of the declarations and code for a new widget class
among a public .h file for application programmer use, a private .h file
for widget programmer use,
and the implementation .c file is described in <a class="xref" href="#Widget_Classing" title="Widget Classing">the section called “Widget Classing”</a>
The predefined widget classes adhere to these conventions.
</p><p>
A widget instance is composed of two parts:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A data structure which contains instance-specific values.
</p></li><li class="listitem"><p>
A class structure which contains information that is applicable to
all widgets of that class.
</p></li></ul></div><p>
Much of the input/output of a widget (for example, fonts, colors, sizes,
or border widths) is customizable by users.
</p><p>
This chapter discusses the base widget classes,
Core, Composite, and Constraint, and
ends with a discussion of widget classing.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Core_Widgets"></a>Core Widgets</h3></div></div></div><p>
The
Core
widget class contains the definitions of fields common to all widgets.
All widgets classes are subclasses of the
Core class,
which is defined by the
<code class="function">CoreClassPart</code>
and
<code class="function">CorePart</code>
structures.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="CoreClassPart_Structure"></a>CoreClassPart Structure</h4></div></div></div><p>
All widget classes contain the fields defined in the
<code class="function">CoreClassPart</code>
structure.
</p><div class="literallayout"><p><br />
typedef struct {<br />
WidgetClass superclass; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
String class_name; See <a class="xref" href="#Resource_Management" title="Chapter 9. Resource Management">Chapter 9</a><br />
Cardinal widget_size; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
XtProc class_initialize; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
XtWidgetClassProc class_part_initialize; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
XtEnum class_inited; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
XtInitProc initialize; See <a class="xref" href="#Creating_Widgets" title="Creating Widgets">Section </a><br />
XtArgsProc initialize_hook; See <a class="xref" href="#Creating_Widgets" title="Creating Widgets">Section </a><br />
XtRealizeProc realize; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
XtActionList actions; See <a class="xref" href="#Translation_Management" title="Chapter 10. Translation Management">Chapter 10</a><br />
Cardinal num_actions; See <a class="xref" href="#Translation_Management" title="Chapter 10. Translation Management">Chapter 10</a><br />
XtResourceList resources; See <a class="xref" href="#Resource_Management" title="Chapter 9. Resource Management">Chapter 9</a><br />
Cardinal num_resources; See <a class="xref" href="#Resource_Management" title="Chapter 9. Resource Management">Chapter 9</a><br />
XrmClass xrm_class; Private to resource manager<br />
Boolean compress_motion; See <a class="xref" href="#X_Event_Filters" title="X Event Filters">Section </a><br />
XtEnum compress_exposure; See <a class="xref" href="#X_Event_Filters" title="X Event Filters">Section </a><br />
Boolean compress_enterleave; See <a class="xref" href="#X_Event_Filters" title="X Event Filters">Section </a><br />
Boolean visible_interest; See <a class="xref" href="#Widget_Exposure_and_Visibility" title="Widget Exposure and Visibility">Section </a><br />
XtWidgetProc destroy; See <a class="xref" href="#Destroying_Widgets" title="Destroying Widgets">Section </a><br />
XtWidgetProc resize; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a> <br />
XtExposeProc expose; See <a class="xref" href="#Widget_Exposure_and_Visibility" title="Widget Exposure and Visibility">Section </a><br />
XtSetValuesFunc set_values; See <a class="xref" href="#Reading_and_Writing_Widget_State" title="Reading and Writing Widget State">Section </a><br />
XtArgsFunc set_values_hook; See <a class="xref" href="#Reading_and_Writing_Widget_State" title="Reading and Writing Widget State">Section </a><br />
XtAlmostProc set_values_almost; See <a class="xref" href="#Reading_and_Writing_Widget_State" title="Reading and Writing Widget State">Section </a><br />
XtArgsProc get_values_hook; See <a class="xref" href="#Reading_and_Writing_Widget_State" title="Reading and Writing Widget State">Section </a><br />
XtAcceptFocusProc accept_focus; See <a class="xref" href="#Focusing_Events_on_a_Child" title="Focusing Events on a Child">Section </a><br />
XtVersionType version; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
XtPointer callback_private; Private to callbacks<br />
String tm_table; See <a class="xref" href="#Translation_Management" title="Chapter 10. Translation Management">Chapter 10</a><br />
XtGeometryHandler query_geometry; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a><br />
XtStringProc display_accelerator; See <a class="xref" href="#Translation_Management" title="Chapter 10. Translation Management">Chapter 10</a><br />
XtPointer extension; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
} CoreClassPart;<br />
</p></div><p>
All widget classes have the Core class fields as their first component.
The prototypical
<code class="function">WidgetClass</code>
and
<code class="function">CoreWidgetClass</code>
are defined with only this set of fields.
</p><div class="literallayout"><p><br />
typedef struct {<br />
CoreClassPart core_class;<br />
} WidgetClassRec, *WidgetClass, CoreClassRec, *CoreWidgetClass;<br />
</p></div><p>
Various routines can cast widget class pointers, as needed,
to specific widget class types.
</p><p>
The single occurrences of the class record and pointer for
creating instances of Core are
</p><p>
In
<code class="function">IntrinsicP.h</code>:
</p><div class="literallayout"><p><br />
extern WidgetClassRec widgetClassRec;<br />
#define coreClassRec widgetClassRec<br />
</p></div><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
extern WidgetClass widgetClass, coreWidgetClass;<br />
</p></div><p>
The opaque types
<code class="function">Widget</code>
and
<code class="function">WidgetClass</code>
and the opaque variable
<code class="function">widgetClass</code>
are defined for generic actions on widgets.
In order to make these types opaque and ensure that the compiler
does not allow applications to access private data, the Intrinsics use
incomplete structure definitions in
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
typedef struct _WidgetClassRec *WidgetClass, *CoreWidgetClass;<br />
</p></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="CorePart_Structure"></a>CorePart Structure</h4></div></div></div><p>
All widget instances contain the fields defined in the
<code class="function">CorePart</code>
structure.
</p><div class="literallayout"><p><br />
typedef struct _CorePart {<br />
Widget self; Described below<br />
WidgetClass widget_class; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
Widget parent; See <a class="xref" href="#Creating_Widgets" title="Creating Widgets">Section </a><br />
Boolean being_destroyed; See <a class="xref" href="#Destroying_Widgets" title="Destroying Widgets">Section </a><br />
XtCallbackList destroy_callbacks; <a class="xref" href="#Destroying_Widgets" title="Destroying Widgets">Section </a><br />
XtPointer constraints; See <a class="xref" href="#Constrained_Composite_Widgets" title="Constrained Composite Widgets">Section </a><br />
Position x; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a><br />
Position y; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a><br />
Dimension width; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a><br />
Dimension height; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a><br />
Dimension border_width; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a><br />
Boolean managed; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
Boolean sensitive; See <a class="xref" href="#Setting_and_Checking_the_Sensitivity_State_of_a_Widget" title="Setting and Checking the Sensitivity State of a Widget">Section </a><br />
Boolean ancestor_sensitive; See <a class="xref" href="#Setting_and_Checking_the_Sensitivity_State_of_a_Widget" title="Setting and Checking the Sensitivity State of a Widget">Section </a><br />
XtTranslations accelerators; See <a class="xref" href="#Translation_Management" title="Chapter 10. Translation Management">Chapter 10</a><br />
Pixel border_pixel; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
Pixmap border_pixmap; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
WidgetList popup_list; See <a class="xref" href="#Pop_Up_Widgets" title="Chapter 5. Pop-Up Widgets">Chapter 5</a><br />
Cardinal num_popups; See <a class="xref" href="#Pop_Up_Widgets" title="Chapter 5. Pop-Up Widgets">Chapter 5</a><br />
String name; See <a class="xref" href="#Resource_Management" title="Chapter 9. Resource Management">Chapter 9</a><br />
Screen *screen; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
Colormap colormap; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
Window window; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
Cardinal depth; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
Pixel background_pixel; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
Pixmap background_pixmap; See <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">Section </a><br />
Boolean visible; See <a class="xref" href="#Widget_Exposure_and_Visibility" title="Widget Exposure and Visibility">Section </a><br />
Boolean mapped_when_managed; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
} CorePart;<br />
</p></div><p>
All widget instances have the Core fields as their first component.
The prototypical type
<code class="function">Widget</code>
is defined with only this set of fields.
</p><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
} WidgetRec, *Widget, CoreRec, *CoreWidget;<br />
</p></div><p>
Various routines can cast widget pointers, as needed,
to specific widget types.
</p><p>
In order to make these types opaque and ensure that the compiler
does not allow applications to access private data, the Intrinsics use
incomplete structure definitions in
<code class="function">Intrinsic.h</code>.
</p><div class="literallayout"><p><br />
typedef struct _WidgetRec *Widget, *CoreWidget;<br />
</p></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Core_Resources"></a>Core Resources</h4></div></div></div><p>
The resource names, classes, and representation types specified in the
<code class="function">coreClassRec</code>
resource list are
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNaccelerators</td><td align="left">XtCAccelerators</td><td align="left">XtRAcceleratorTable</td></tr><tr><td align="left">XtNbackground</td><td align="left">XtCBackground</td><td align="left">XtRPixel</td></tr><tr><td align="left">XtNbackgroundPixmap</td><td align="left">XtCPixmap</td><td align="left">XtRPixmap</td></tr><tr><td align="left">XtNborderColor</td><td align="left">XtCBorderColor</td><td align="left">XtRPixel</td></tr><tr><td align="left">XtNborderPixmap</td><td align="left">XtCPixmap</td><td align="left">XtRPixmap</td></tr><tr><td align="left">XtNcolormap</td><td align="left">XtCColormap</td><td align="left">XtRColormap</td></tr><tr><td align="left">XtNdepth</td><td align="left">XtCDepth</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNmappedWhenManaged</td><td align="left">XtCMappedWhenManaged</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNscreen</td><td align="left">XtCScreen</td><td align="left">XtRScreen</td></tr><tr><td align="left">XtNtranslations</td><td align="left">XtCTranslations</td><td align="left">XtRTranslationTable</td></tr></tbody></table></div><p>
Additional resources are defined for all widgets via the
<code class="function">objectClassRec</code>
and
<code class="function">rectObjClassRec</code>
resource lists; see <a class="xref" href="#Object_Objects" title="Object Objects">the section called “Object Objects”</a> and <a class="xref" href="#Rectangle_Objects" title="Rectangle Objects">the section called “Rectangle Objects”</a> for details.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="CorePart_Default_Values"></a>CorePart Default Values</h4></div></div></div><p>
The default values for the Core fields, which are filled in by the Intrinsics,
from the resource lists, and by the initialize procedures, are
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Default Value</th></tr></thead><tbody><tr><td align="left">self</td><td align="left">Address of the widget structure (may not be changed).</td></tr><tr><td align="left">widget_class</td><td align="left"><span class="emphasis"><em>widget_class</em></span> argument to
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
(may not be changed).</td></tr><tr><td align="left">parent</td><td align="left"><span class="emphasis"><em>parent</em></span> argument to
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
(may not be changed).</td></tr><tr><td align="left">being_destroyed</td><td align="left">Parent's <span class="emphasis"><em>being_destroyed</em></span> value.</td></tr><tr><td align="left">destroy_callbacks</td><td align="left">NULL</td></tr><tr><td align="left">constraints</td><td align="left">NULL</td></tr><tr><td align="left">x</td><td align="left">0</td></tr><tr><td align="left">y</td><td align="left">0</td></tr><tr><td align="left">width</td><td align="left">0</td></tr><tr><td align="left">height</td><td align="left">0</td></tr><tr><td align="left">border_width</td><td align="left">1</td></tr><tr><td align="left">managed</td><td align="left"><code class="function">False</code></td></tr><tr><td align="left">sensitive</td><td align="left"><code class="function">True</code></td></tr><tr><td align="left">ancestor_sensitive</td><td align="left">logical AND of parent's <span class="emphasis"><em>sensitive</em></span> and
<span class="emphasis"><em>ancestor_sensitive</em></span> values.</td></tr><tr><td align="left">accelerators</td><td align="left">NULL</td></tr><tr><td align="left">border_pixel</td><td align="left"><code class="function">XtDefaultForeground</code></td></tr><tr><td align="left">border_pixmap</td><td align="left"><code class="function">XtUnspecifiedPixmap</code></td></tr><tr><td align="left">popup_list</td><td align="left">NULL</td></tr><tr><td align="left">num_popups</td><td align="left">0</td></tr><tr><td align="left">name</td><td align="left"><span class="emphasis"><em>name</em></span> argument to
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
(may not be changed).</td></tr><tr><td align="left">screen</td><td align="left">Parent's <span class="emphasis"><em>screen</em></span>; top-level widget gets screen from display specifier
(may not be changed).</td></tr><tr><td align="left">colormap</td><td align="left">Parent's <span class="emphasis"><em>colormap</em></span> value.</td></tr><tr><td align="left">window</td><td align="left">NULL</td></tr><tr><td align="left">depth</td><td align="left">Parent's <span class="emphasis"><em>depth</em></span>; top-level widget gets root window depth.</td></tr><tr><td align="left">background_pixel</td><td align="left"><code class="function">XtDefaultBackground</code></td></tr><tr><td align="left">background_pixmap</td><td align="left"><code class="function">XtUnspecifiedPixmap</code></td></tr><tr><td align="left">visible</td><td align="left"><code class="function">True</code></td></tr><tr><td align="left">mapped_when_managed</td><td align="left"><code class="function">True</code></td></tr></tbody></table></div><p>
<code class="function">XtUnspecifiedPixmap</code>
is a symbolic constant guaranteed to be unequal to
any valid Pixmap id,
<code class="function">None</code>,
and
<code class="function">ParentRelative</code>.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Composite_Widgets"></a>Composite Widgets</h3></div></div></div><p>
The Composite
widget class is a subclass of the
Core
widget class (see <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3, <em>Composite Widgets and Their Children</em></a>).
Composite widgets are intended to be containers for other widgets.
The additional data used by composite widgets are defined by the
<code class="function">CompositeClassPart</code>
and
<code class="function">CompositePart</code>
structures.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="CompositeClassPart_Structure"></a>CompositeClassPart Structure</h4></div></div></div><p>
In addition to the
Core
class fields,
widgets of the Composite class have the following class fields.
</p><div class="literallayout"><p><br />
typedef struct {<br />
XtGeometryHandler geometry_manager; See <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6</a><br />
XtWidgetProc change_managed; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
XtWidgetProc insert_child; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
XtWidgetProc delete_child; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
XtPointer extension; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
} CompositeClassPart;<br />
</p></div><p>
The extension record defined for
<code class="function">CompositeClassPart</code>
with <span class="emphasis"><em>record_type</em></span>
equal to
<span class="strong"><strong>NULLQUARK</strong></span>
is
<code class="function">CompositeClassExtensionRec</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
XtPointer next_extension; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
XrmQuark record_type; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
long version; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
Cardinal record_size; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
Boolean accepts_objects; See <a class="xref" href="#Creating_a_Widget_Instance" title="Creating a Widget Instance">Section </a><br />
Boolean allows_change_managed_set; See <a class="xref" href="#Bundling_Changes_to_the_Managed_Set" title="Bundling Changes to the Managed Set">Section </a><br />
} CompositeClassExtensionRec, *CompositeClassExtension;<br />
</p></div><p>
Composite
classes have the Composite class fields immediately following the
Core class fields.
</p><div class="literallayout"><p><br />
typedef struct {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
} CompositeClassRec, *CompositeWidgetClass;<br />
</p></div><p>
The single occurrences of the class record and pointer for creating
instances of Composite are
</p><p>
In
<code class="function">IntrinsicP.h</code>:
</p><div class="literallayout"><p><br />
extern CompositeClassRec compositeClassRec;<br />
</p></div><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
extern WidgetClass compositeWidgetClass;<br />
</p></div><p>
The opaque types
<code class="function">CompositeWidget</code>
and
<code class="function">CompositeWidgetClass</code>
and the opaque variable
<code class="function">compositeWidgetClass</code>
are defined for generic operations on widgets whose class
is Composite or a subclass of Composite.
The symbolic constant for the
<code class="function">CompositeClassExtension</code>
version identifier is
<code class="function">XtCompositeExtensionVersion</code>
(see <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a>).
<code class="function">Intrinsic.h</code>
uses an incomplete structure
definition to ensure that the compiler catches attempts to access
private data.
</p><div class="literallayout"><p><br />
typedef struct _CompositeClassRec *CompositeWidgetClass;<br />
</p></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="CompositePart_Structure"></a>CompositePart Structure</h4></div></div></div><p>
In addition to the
Core instance
fields,
widgets of the Composite class have the following
instance fields defined in the
<code class="function">CompositePart</code>
structure.
</p><div class="literallayout"><p><br />
typedef struct {<br />
WidgetList children; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
Cardinal num_children; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
Cardinal num_slots; See <a class="xref" href="#Composite_Widgets_and_Their_Children" title="Chapter 3. Composite Widgets and Their Children">Chapter 3</a><br />
XtOrderProc insert_position; See <a class="xref" href="#Insertion_Order_of_Children_The_insert_position_Procedure" title="Insertion Order of Children: The insert_position Procedure">Section </a><br />
} CompositePart;<br />
</p></div><p>
Composite
widgets have the Composite instance fields immediately following the Core
instance fields.
</p><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
} CompositeRec, *CompositeWidget;<br />
</p></div><p>
<code class="function">Intrinsic.h</code>
uses an incomplete structure definition to ensure that the
compiler catches attempts to access private data.
</p><div class="literallayout"><p><br />
typedef struct _CompositeRec *CompositeWidget;<br />
</p></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Composite_Resources"></a>Composite Resources</h4></div></div></div><p>
The resource names, classes, and representation types
that are specified in
the
<code class="function">compositeClassRec</code>
resource list are
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNchildren</td><td align="left">XtCReadOnly</td><td align="left">XtRWidgetList</td></tr><tr><td align="left">XtNinsertPosition</td><td align="left">XtCInsertPosition</td><td align="left">XtRFunction</td></tr><tr><td align="left">XtNnumChildren</td><td align="left">XtCReadOnly</td><td align="left">XtRCardinal</td></tr></tbody></table></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="CompositePart_Default_Values"></a>CompositePart Default Values</h4></div></div></div><p>
The default values for the Composite fields,
which are filled in from the
Composite
resource list and by the
Composite
initialize procedure, are
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Default Value</th></tr></thead><tbody><tr><td align="left">children</td><td align="left">NULL</td></tr><tr><td align="left">num_children</td><td align="left">0</td></tr><tr><td align="left">num_slots</td><td align="left">0</td></tr><tr><td align="left">insert_position</td><td align="left">Internal function to insert at end</td></tr></tbody></table></div><p>
The <span class="emphasis"><em>children</em></span>, <span class="emphasis"><em>num_children</em></span>,
and <span class="emphasis"><em>insert_position</em></span> fields are declared
as resources;
XtNinsertPosition
is a settable resource,
XtNchildren
and
XtNnumChildren
may be read by any client but should only be modified by the composite
widget class procedures.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Constraint_Widgets"></a>Constraint Widgets</h3></div></div></div><p>
The Constraint
widget class is a subclass of the
Composite
widget class (see <a class="xref" href="#Constrained_Composite_Widgets" title="Constrained Composite Widgets">the section called “Constrained Composite Widgets”</a>). Constraint
widgets maintain additional state
data for each child; for example, client-defined constraints on the child's
geometry.
The additional data used by constraint widgets are defined by the
<code class="function">ConstraintClassPart</code>
and
<code class="function">ConstraintPart</code>
structures.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="ConstraintClassPart_Structure"></a>ConstraintClassPart Structure</h4></div></div></div><p>
In addition to the
Core
and
Composite
class fields,
widgets of the Constraint class
have the following class fields.
</p><div class="literallayout"><p><br />
typedef struct {<br />
XtResourceList resources; See <a class="xref" href="#Resource_Management" title="Chapter 9. Resource Management">Chapter 9</a><br />
Cardinal num_resources; See <a class="xref" href="#Resource_Management" title="Chapter 9. Resource Management">Chapter 9</a><br />
Cardinal constraint_size; See <a class="xref" href="#Constrained_Composite_Widgets" title="Constrained Composite Widgets">Section </a><br />
XtInitProc initialize; See <a class="xref" href="#Constrained_Composite_Widgets" title="Constrained Composite Widgets">Section </a><br />
XtWidgetProc destroy; See <a class="xref" href="#Constrained_Composite_Widgets" title="Constrained Composite Widgets">Section </a><br />
XtSetValuesFunc set_values; See <a class="xref" href="#Setting_Widget_State" title="Setting Widget State">Section </a><br />
XtPointer extension; See <a class="xref" href="#Widget_Classing" title="Widget Classing">Section </a><br />
} ConstraintClassPart;<br />
</p></div><p>
The extension record defined for
<code class="function">ConstraintClassPart</code>
with <span class="emphasis"><em>record_type</em></span> equal to
<span class="strong"><strong>NULLQUARK</strong></span>
is
<code class="function">ConstraintClassExtensionRec</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
XtPointer next_extension; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
XrmQuark record_type; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
long version; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
Cardinal record_size; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">Section </a><br />
XtArgsProc get_values_hook; See <a class="xref" href="#Obtaining_Widget_State" title="Obtaining Widget State">Section </a><br />
} ConstraintClassExtensionRec, *ConstraintClassExtension;<br />
</p></div><p>
Constraint
classes have the Constraint class fields immediately following the
Composite class fields.
</p><div class="literallayout"><p><br />
typedef struct _ConstraintClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ConstraintClassPart constraint_class;<br />
} ConstraintClassRec, *ConstraintWidgetClass;<br />
</p></div><p>
The single occurrences of the class record and pointer for creating
instances of Constraint are
</p><p>
In
<code class="function">IntrinsicP.h</code>:
</p><div class="literallayout"><p><br />
extern ConstraintClassRec constraintClassRec;<br />
</p></div><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
extern WidgetClass constraintWidgetClass;<br />
</p></div><p>
The opaque types
<code class="function">ConstraintWidget</code>
and
<code class="function">ConstraintWidgetClass</code>
and the opaque variable
<code class="function">constraintWidgetClass</code>
are defined for generic operations on widgets
whose class is Constraint or a subclass
of Constraint.
The symbolic constant for the
<code class="function">ConstraintClassExtension</code>
version identifier is
<code class="function">XtConstraintExtensionVersion</code>
(see <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a>).
<code class="function">Intrinsic.h</code>
uses an incomplete structure definition to ensure that the
compiler catches attempts to access private data.
</p><div class="literallayout"><p><br />
typedef struct _ConstraintClassRec *ConstraintWidgetClass;<br />
</p></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="ConstraintPart_Structure"></a>ConstraintPart Structure</h4></div></div></div><p>
In addition to the
Core
and
Composite instance
fields,
widgets of the Constraint class have the following unused
instance fields defined in the
<code class="function">ConstraintPart</code>
structure
</p><div class="literallayout"><p><br />
typedef struct {<br />
int empty;<br />
} ConstraintPart;<br />
</p></div><p>
Constraint
widgets have the Constraint instance fields immediately following the
Composite instance fields.
</p><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ConstraintPart constraint;<br />
} ConstraintRec, *ConstraintWidget;<br />
</p></div><p>
<code class="function">Intrinsic.h</code>
uses an incomplete structure definition to ensure that the
compiler catches attempts to access private data.
</p><div class="literallayout"><p><br />
typedef struct _ConstraintRec *ConstraintWidget;<br />
</p></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Constraint_Resources"></a>Constraint Resources</h4></div></div></div><p>
The
<code class="function">constraintClassRec</code>
<span class="emphasis"><em>core_class</em></span> and <span class="emphasis"><em>constraint_class resources</em></span> fields are NULL,
and the <span class="emphasis"><em>num_resources</em></span> fields are zero;
no additional resources beyond those declared by
the superclasses
are defined for
Constraint.
</p></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Implementation_Specific_Types"></a>Implementation-Specific Types</h2></div></div></div><p>
To increase the portability of widget and application source code
between different system environments, the Intrinsics define several
types whose precise representation is explicitly dependent upon,
and chosen by, each individual implementation of the Intrinsics.
</p><p>
These implementation-defined types are
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="strong"><strong>Boolean</strong></span>
</span></p></td><td><p>
A datum that contains a zero or nonzero value.
Unless explicitly stated, clients should not assume
that the nonzero value is equal to the symbolic
value
<code class="function">True</code>.
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>Cardinal</strong></span>
</span></p></td><td><p>
An unsigned integer datum with a minimum range of [0..2^16-1].
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>Dimension</strong></span>
</span></p></td><td><p>
An unsigned integer datum with a minimum range of [0..2^16-1].
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>Position</strong></span>
</span></p></td><td><p>
A signed integer datum with a minimum range of [-2^15..2^15-1].
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>XtPointer</strong></span>
</span></p></td><td><p>
A datum large enough to contain the largest of a char*, int*, function
pointer, structure pointer, or long value. A pointer
to any type or function, or a long value may be converted
to an
<code class="function">XtPointer</code>
and back again and the result will
compare equal to the original value. In ANSI C
environments it is expected that
<code class="function">XtPointer</code>
will be
defined as void*.
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>XtArgVal</strong></span>
</span></p></td><td><p>
A datum large enough to contain an
<code class="function">XtPointer</code>,
<code class="function">Cardinal</code>,
<code class="function">Dimension</code>,
or
<code class="function">Position</code>
value.
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>XtEnum</strong></span>
</span></p></td><td><p>
An integer datum large enough to encode at least 128 distinct
values, two of which are the symbolic values
<code class="function">True</code>
and
<code class="function">False</code>.
The symbolic values
<span class="strong"><strong>TRUE</strong></span>
and
<span class="strong"><strong>FALSE</strong></span>
are
also defined to be equal to
<code class="function">True</code>
and
<code class="function">False</code>,
respectively.
</p></td></tr></tbody></table></div><p>
In addition to these specific types, the precise order of the
fields within the structure declarations for any of the instance
part records
<code class="function">ObjectPart</code>,
<code class="function">RectObjPart</code>,
<code class="function">CorePart</code>,
<code class="function">CompositePart</code>,
<code class="function">ShellPart</code>,
<code class="function">WMShellPart</code>,
<code class="function">TopLevelShellPart</code>,
and
<code class="function">ApplicationShellPart</code>
is implementation-defined. These
structures may also have additional private
fields internal to the implementation.
The
<code class="function">ObjectPart</code>,
<code class="function">RectObjPart</code>,
and
<code class="function">CorePart</code>
structures must be defined so that any member with the same name
appears at the same offset in
<code class="function">ObjectRec</code>,
<code class="function">RectObjRec</code>,
and
<code class="function">CoreRec</code>
<code class="function">( WidgetRec ).</code>
No other relations between the offsets of any two
fields may be assumed.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Widget_Classing"></a>Widget Classing</h2></div></div></div><p>
The <span class="emphasis"><em>widget_class</em></span> field of a widget points to its widget class structure,
which contains information that is constant across all widgets of that class.
As a consequence,
widgets usually do not implement directly callable procedures;
rather, they implement procedures, called methods, that are available through
their widget class structure.
These methods are invoked by generic procedures that envelop common actions
around the methods implemented by the widget class.
Such procedures are applicable to all widgets
of that class and also to widgets whose classes are subclasses of that class.
</p><p>
All widget classes are a subclass of
Core
and can be subclassed further.
Subclassing reduces the amount of code and declarations
necessary to make a
new widget class that is similar to an existing class.
For example, you do not have to describe every resource your widget uses in an
<code class="function">XtResourceList</code>.
Instead, you describe only the resources your widget has
that its superclass does not.
Subclasses usually inherit many of their superclasses' procedures
(for example, the expose procedure or geometry handler).
</p><p>
Subclassing, however, can be taken too far.
If you create a subclass that inherits none of the procedures of its
superclass,
you should consider whether you have chosen the most
appropriate superclass.
</p><p>
To make good use of subclassing,
widget declarations and naming conventions are highly stylized.
A widget consists of three files:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A public .h file, used by client widgets or applications.
</p></li><li class="listitem"><p>
A private .h file, used by widgets whose classes
are subclasses of the widget class.
</p></li><li class="listitem"><p>
A .c file, which implements the widget.
</p></li></ul></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Naming_Conventions"></a>Widget Naming Conventions</h3></div></div></div><p>
The Intrinsics provide a vehicle by which programmers can create
new widgets and organize a collection of widgets into an application.
To ensure that applications need not deal with as many styles of capitalization
and spelling as the number of widget classes it uses,
the following guidelines should be followed when writing new widgets:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Use the X library naming conventions that are applicable.
For example, a record component name is all lowercase
and uses underscores (_) for compound words (for example, background_pixmap).
Type and procedure names start with uppercase and use capitalization for
compound words (for example,
<code class="function">ArgList</code>
or
<code class="function">XtSetValues ).</code>
</p></li><li class="listitem"><p>
A resource name is spelled identically to the field name
except that compound names use capitalization rather than underscore.
To let the compiler catch spelling errors,
each resource name should have a symbolic identifier prefixed with
``XtN''.
For example,
the <span class="emphasis"><em>background_pixmap</em></span> field has the corresponding identifier
XtNbackgroundPixmap,
which is defined as the string ``backgroundPixmap''.
Many predefined names are listed in
<code class="function"><X11/StringDefs.h></code>.
Before you invent a new name,
you should make sure there is not already a name that you can use.
</p></li><li class="listitem"><p>
A resource class string starts with a capital letter
and uses capitalization for compound names (for example,``BorderWidth'').
Each resource class string should have a symbolic identifier prefixed with
``XtC''
(for example, XtCBorderWidth).
Many predefined classes are listed in
<code class="function"><X11/StringDefs.h></code>.
</p></li><li class="listitem"><p>
A resource representation string is spelled identically to the type name
(for example, ``TranslationTable'').
Each representation string should have a symbolic identifier prefixed with
``XtR''
(for example, XtRTranslationTable).
Many predefined representation types are listed in
<code class="function"><X11/StringDefs.h></code>.
</p></li><li class="listitem"><p>
New widget classes start with a capital and use uppercase for compound
words.
Given a new class name AbcXyz, you should derive several names:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
Additional widget instance structure part name AbcXyzPart.
</p></li><li class="listitem"><p>
Complete widget instance structure names AbcXyzRec and _AbcXyzRec.
</p></li><li class="listitem"><p>
Widget instance structure pointer type name AbcXyzWidget.
</p></li><li class="listitem"><p>
Additional class structure part name AbcXyzClassPart.
</p></li><li class="listitem"><p>
Complete class structure names AbcXyzClassRec and _AbcXyzClassRec.
</p></li><li class="listitem"><p>
Class structure pointer type name AbcXyzWidgetClass.
</p></li><li class="listitem"><p>
Class structure variable abcXyzClassRec.
</p></li><li class="listitem"><p>
Class structure pointer variable abcXyzWidgetClass.
</p></li></ul></div></li><li class="listitem"><p>
Action procedures available to translation specifications should follow the
same naming conventions as procedures.
That is,
they start with a capital letter, and compound names use uppercase
(for example, ``Highlight'' and ``NotifyClient'').
</p></li></ul></div><p>
The symbolic identifiers XtN..., XtC..., and XtR...
may be implemented
as macros, as global symbols, or as a mixture of the two. The
(implicit) type of the identifier is
<code class="function">String</code>.
The pointer value itself
is not significant; clients must not assume that inequality of two
identifiers implies inequality of the resource name, class, or
representation string. Clients should also note that although global
symbols permit savings in literal storage in some environments, they
also introduce the possibility of multiple definition conflicts when
applications attempt to use independently developed widgets
simultaneously.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Subclassing_in_Public_h_Files"></a>Widget Subclassing in Public .h Files</h3></div></div></div><p>
The public .h file for a widget class is imported by clients
and contains
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A reference to the public .h file for the superclass.
</p></li><li class="listitem"><p>
Symbolic identifiers for
the names and classes of the new resources that this widget adds
to its superclass.
The definitions should
have a single space between the definition name and the value and no
trailing space or comment in order to reduce the possibility of
compiler warnings from similar declarations in multiple classes.
</p></li><li class="listitem"><p>
Type declarations for any new resource data types defined by the class.
</p></li><li class="listitem"><p>
The class record pointer variable used to create widget instances.
</p></li><li class="listitem"><p>
The C type that corresponds to widget instances of this class.
</p></li><li class="listitem"><p>
Entry points for new class methods.
</p></li></ul></div><p>
For example, the following is the public .h file for a possible
implementation of a Label widget:
</p><div class="literallayout"><p><br />
#ifndef LABEL_H<br />
#define LABEL_H<br />
/* New resources */<br />
#define XtNjustify "justify"<br />
#define XtNforeground "foreground"<br />
#define XtNlabel "label"<br />
#define XtNfont "font"<br />
#define XtNinternalWidth "internalWidth"<br />
#define XtNinternalHeight "internalHeight"<br />
/* Class record pointer */<br />
extern WidgetClass labelWidgetClass;<br />
/* C Widget type definition */<br />
typedef struct _LabelRec *LabelWidget;<br />
/* New class method entry points */<br />
extern void LabelSetText();<br />
/* Widget w */<br />
/* String text */<br />
extern String LabelGetText();<br />
/* Widget w */<br />
#endif LABEL_H<br />
</p></div><p>
The conditional inclusion of the text allows the application
to include header files for different widgets without being concerned
that they already may be included as a superclass of another widget.
</p><p>
To accommodate operating systems with file name length restrictions,
the name of the public .h file is the first ten characters of the
widget class.
For example,
the public .h file for the
Constraint
widget class is
<code class="function">Constraint.h</code>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Subclassing_in_Private_h_Files"></a>Widget Subclassing in Private .h Files</h3></div></div></div><p>
The private .h file for a widget is imported by widget classes that are
subclasses of the widget and contains
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A reference to the public .h file for the class.
</p></li><li class="listitem"><p>
A reference to the private .h file for the superclass.
</p></li><li class="listitem"><p>
Symbolic identifiers for any new resource representation types defined
by the class. The definitions should have a single space between the
definition name and the value and no trailing space or comment.
</p></li><li class="listitem"><p>
A structure part definition for
the new fields that the widget instance adds to its superclass's
widget structure.
</p></li><li class="listitem"><p>
The complete widget instance structure definition for this widget.
</p></li><li class="listitem"><p>
A structure part definition for
the new fields that this widget class adds to its superclass's
constraint
structure if the widget class is a subclass of
Constraint.
</p></li><li class="listitem"><p>
The complete
constraint
structure definition if the widget class is a subclass of
Constraint.
</p></li><li class="listitem"><p>
Type definitions for any new procedure types used by class methods
declared in the widget class part.
</p></li><li class="listitem"><p>
A structure part definition for
the new fields that this widget class adds to its superclass's widget class
structure.
</p></li><li class="listitem"><p>
The complete widget class structure definition for this widget.
</p></li><li class="listitem"><p>
The complete widget class extension structure definition
for this widget, if any.
</p></li><li class="listitem"><p>
The symbolic constant identifying the class extension version, if any.
</p></li><li class="listitem"><p>
The name of the global class structure variable containing the generic
class structure for this class.
</p></li><li class="listitem"><p>
An inherit constant for each new procedure in the widget class part structure.
</p></li></ul></div><p>
For example, the following is the private .h file for a possible Label widget:
</p><div class="literallayout"><p><br />
#ifndef LABELP_H<br />
#define LABELP_H<br />
#include <X11/Label.h><br />
/* New representation types used by the Label widget */<br />
#define XtRJustify "Justify"<br />
/* New fields for the Label widget record */<br />
typedef struct {<br />
/* Settable resources */<br />
Pixel foreground;<br />
XFontStruct *font;<br />
String label; /* text to display */<br />
XtJustify justify;<br />
Dimension internal_width; /* # pixels horizontal border */<br />
Dimension internal_height; /* # pixels vertical border */<br />
/* Data derived from resources */<br />
GC normal_GC;<br />
GC gray_GC;<br />
Pixmap gray_pixmap;<br />
Position label_x;<br />
Position label_y;<br />
Dimension label_width;<br />
Dimension label_height;<br />
Cardinal label_len;<br />
Boolean display_sensitive;<br />
} LabelPart;<br />
</p></div><div class="literallayout"><p><br />
/* Full instance record declaration */<br />
typedef struct _LabelRec {<br />
CorePart core;<br />
LabelPart label;<br />
} LabelRec;<br />
/* Types for Label class methods */<br />
typedef void (*LabelSetTextProc)();<br />
/* Widget w */<br />
/* String text */<br />
typedef String (*LabelGetTextProc)();<br />
/* Widget w */<br />
/* New fields for the Label widget class record */<br />
typedef struct {<br />
LabelSetTextProc set_text;<br />
LabelGetTextProc get_text;<br />
XtPointer extension;<br />
} LabelClassPart;<br />
/* Full class record declaration */<br />
typedef struct _LabelClassRec {<br />
CoreClassPart core_class;<br />
LabelClassPart label_class;<br />
} LabelClassRec;<br />
/* Class record variable */<br />
extern LabelClassRec labelClassRec;<br />
#define LabelInheritSetText((LabelSetTextProc)_XtInherit)<br />
#define LabelInheritGetText((LabelGetTextProc)_XtInherit)<br />
#endif LABELP_H<br />
</p></div><p>
To accommodate operating systems with file name length restrictions,
the name of the private .h file is the first nine characters of the
widget class followed by a capital P.
For example,
the private .h file for the
Constraint
widget class is
<code class="function">ConstrainP.h</code>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Subclassing_in_c_Files"></a>Widget Subclassing in .c Files</h3></div></div></div><p>
The .c file for a widget contains the structure initializer
for the class record variable,
which contains the following parts:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Class information (for example, <span class="emphasis"><em>superclass</em></span>, <span class="emphasis"><em>class_name</em></span>,
<span class="emphasis"><em>widget_size</em></span>,
<span class="emphasis"><em>class_initialize</em></span>, and <span class="emphasis"><em>class_inited</em></span>).
</p></li><li class="listitem"><p>
Data constants (for example, <span class="emphasis"><em>resources</em></span> and <span class="emphasis"><em>num_resources</em></span>,
<span class="emphasis"><em>actions</em></span> and <span class="emphasis"><em>num_actions</em></span>, <span class="emphasis"><em>visible_interest</em></span>,
<span class="emphasis"><em>compress_motion</em></span>,
<span class="emphasis"><em>compress_exposure</em></span>, and <span class="emphasis"><em>version</em></span>).
</p></li><li class="listitem"><p>
Widget operations (for example, <span class="emphasis"><em>initialize</em></span>, <span class="emphasis"><em>realize</em></span>, <span class="emphasis"><em>destroy</em></span>,
<span class="emphasis"><em>resize</em></span>, <span class="emphasis"><em>expose</em></span>, <span class="emphasis"><em>set_values</em></span>, <span class="emphasis"><em>accept_focus</em></span>,
and any new operations specific to
the widget).
</p></li></ul></div><p>
The <span class="emphasis"><em>superclass</em></span> field points to the superclass
global class
record, declared in the superclass private .h file.
For direct subclasses of the generic core widget,
<span class="emphasis"><em>superclass</em></span> should be initialized to the address of the
<code class="function">widgetClassRec</code>
structure.
The superclass is used for class chaining operations and for
inheriting or enveloping a superclass's operations
(see <a class="xref" href="#Superclass_Chaining" title="Superclass Chaining">the section called “Superclass Chaining”</a>,
<a class="xref" href="#Initializing_a_Widget_Class" title="Initializing a Widget Class">the section called “Initializing a Widget Class”</a>, and
<a class="xref" href="#Inheritance_of_Superclass_Operations" title="Inheritance of Superclass Operations">the section called “Inheritance of Superclass Operations”</a>.
</p><p>
The <span class="emphasis"><em>class_name</em></span> field contains the text name for this class,
which is used by
the resource manager.
For example, the Label widget has the string ``Label''.
More than one widget class can share the same text class name.
This string must be permanently allocated prior to or during the
execution of the class initialization procedure and must not be
subsequently deallocated.
</p><p>
The <span class="emphasis"><em>widget_size</em></span> field is the size of the corresponding widget
instance structure
(not the size of the class structure).
</p><p>
The <span class="emphasis"><em>version</em></span> field indicates the toolkit
implementation version number and is used for
runtime consistency checking of the X Toolkit and widgets in an application.
Widget writers must set it to the
implementation-defined symbolic value
<code class="function">XtVersion</code>
in the widget class structure initialization.
Those widget writers who believe that their widget binaries are compatible
with other implementations of the Intrinsics can put the special value
<code class="function">XtVersionDontCheck</code>
in the <span class="emphasis"><em>version</em></span> field to disable version checking for those widgets.
If a widget needs to compile alternative code for different
revisions of the Intrinsics interface definition, it may use the symbol
<code class="function">XtSpecificationRelease</code>,
as described in <a class="xref" href="#Evolution_of_the_Intrinsics" title="Chapter 13. Evolution of the Intrinsics">Chapter 13, <em>Evolution of the Intrinsics</em></a>.
Use of
<code class="function">XtVersion</code>
allows the Intrinsics implementation to recognize widget binaries
that were compiled with older implementations.
</p><p>
The <span class="emphasis"><em>extension</em></span> field is for future upward compatibility.
If the widget programmer adds fields to class parts,
all subclass structure layouts change,
requiring complete recompilation.
To allow clients to avoid recompilation,
an extension field at the end of each class part can point to a record
that contains any additional class information required.
</p><p>
All other fields are described in their respective sections.
</p><p>
The .c file also contains the declaration of the global class
structure pointer variable used to create instances of the class.
The following is an abbreviated version of the .c file
for a Label widget.
The resources table is described in <a class="xref" href="#Resource_Management" title="Chapter 9. Resource Management">Chapter 9, <em>Resource Management</em></a>.
</p><div class="literallayout"><p><br />
/* Resources specific to Label */<br />
static XtResource resources[] = {<br />
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),<br />
XtOffset(LabelWidget, label.foreground), XtRString,<br />
XtDefaultForeground},<br />
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),<br />
XtOffset(LabelWidget, label.font),XtRString,<br />
XtDefaultFont},<br />
{XtNlabel, XtCLabel, XtRString, sizeof(String),<br />
XtOffset(LabelWidget, label.label), XtRString, NULL},<br />
.<br />
.<br />
.<br />
}<br />
/* Forward declarations of procedures */<br />
static void ClassInitialize();<br />
static void Initialize();<br />
static void Realize();<br />
static void SetText();<br />
static void GetText();<br />
.<br />
.<br />
.<br />
</p></div><div class="literallayout"><p><br />
/* Class record constant */<br />
LabelClassRec labelClassRec = {<br />
{<br />
/* core_class fields */<br />
/* superclass */ (WidgetClass)&coreClassRec,<br />
/* class_name */ "Label",<br />
/* widget_size */ sizeof(LabelRec),<br />
/* class_initialize */ ClassInitialize,<br />
/* class_part_initialize */ NULL,<br />
/* class_inited */ False,<br />
/* initialize */ Initialize,<br />
/* initialize_hook */ NULL,<br />
/* realize */ Realize,<br />
/* actions */ NULL,<br />
/* num_actions */ 0,<br />
/* resources */ resources,<br />
/* num_resources */ XtNumber(resources),<br />
/* xrm_class */ NULLQUARK,<br />
/* compress_motion */ True,<br />
/* compress_exposure */ True,<br />
/* compress_enterleave */ True,<br />
/* visible_interest */ False,<br />
/* destroy */ NULL,<br />
/* resize */ Resize,<br />
/* expose */ Redisplay,<br />
/* set_values */ SetValues,<br />
/* set_values_hook */ NULL,<br />
/* set_values_almost */ XtInheritSetValuesAlmost,<br />
/* get_values_hook */ NULL,<br />
/* accept_focus */ NULL,<br />
/* version */ XtVersion,<br />
/* callback_offsets */ NULL,<br />
/* tm_table */ NULL,<br />
/* query_geometry */ XtInheritQueryGeometry,<br />
/* display_accelerator */ NULL,<br />
/* extension */ NULL<br />
},<br />
{<br />
/* Label_class fields */<br />
/* get_text */ GetText,<br />
/* set_text */ SetText,<br />
/* extension */ NULL<br />
}<br />
};<br />
/* Class record pointer */<br />
WidgetClass labelWidgetClass = (WidgetClass) &labelClassRec;<br />
/* New method access routines */<br />
void LabelSetText(w, text)<br />
Widget w;<br />
String text;<br />
{<br />
LabelWidgetClass lwc = (Label WidgetClass)XtClass(w);<br />
XtCheckSubclass(w, labelWidgetClass, NULL);<br />
*(lwc->label_class.set_text)(w, text)<br />
}<br />
/* Private procedures */<br />
.<br />
.<br />
.<br />
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Class_and_Superclass_Look_Up"></a>Widget Class and Superclass Look Up</h3></div></div></div><p>
To obtain the class of a widget, use
<a class="xref" href="#XtClass"><code class="function">XtClass</code></a>.
</p><div class="funcsynopsis"><a id="XtClass"></a><p><code class="funcdef">WidgetClass <strong class="fsfunc">XtClass</strong>(</code>Widget<var class="pdparam"> w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtClass"><code class="function">XtClass</code></a>
function returns a pointer to the widget's class structure.
</p><p>
To obtain the superclass of a widget, use
<code class="function">XtSuperclass</code>.
</p><div class="funcsynopsis"><a id="XtSuperClass"></a><p><code class="funcdef">WidgetClass <strong class="fsfunc">XtSuperClass</strong>(</code>Widget<var class="pdparam"> w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<code class="function">XtSuperclass</code>
function returns a pointer to the widget's superclass class structure.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Subclass_Verification"></a>Widget Subclass Verification</h3></div></div></div><p>
To check the subclass to which a widget belongs, use
<a class="xref" href="#XtIsSubclass"><code class="function">XtIsSubclass</code></a>.
</p><div class="funcsynopsis"><a id="XtIsSubclass"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtIsSubclass</strong>(</code>Widget<var class="pdparam"> w</var>, WidgetClass<var class="pdparam"> widget_class</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget or object instance whose class is to be checked. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class for which to test. Must be <span class="strong"><strong>objectClass</strong></span> or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtIsSubclass"><code class="function">XtIsSubclass</code></a>
function returns
<code class="function">True</code>
if the class of the specified widget is equal to
or is a subclass of the specified class.
The widget's class can be any number of subclasses down the chain
and need not be an immediate subclass of the specified class.
Composite widgets that need to restrict the class of the items they
contain can use
<a class="xref" href="#XtIsSubclass"><code class="function">XtIsSubclass</code></a>
to find out if a widget belongs to the desired class of objects.
</p><p>
To test if a given widget belongs to a subclass of an Intrinsics-defined
class, the Intrinsics define macros or functions equivalent to
<a class="xref" href="#XtIsSubclass"><code class="function">XtIsSubclass</code></a>
for each of the built-in classes. These procedures are
<code class="function">XtIsObject</code>,
<code class="function">XtIsRectObj</code>,
<code class="function">XtIsWidget</code>,
<code class="function">XtIsComposite</code>,
<code class="function">XtIsConstraint</code>,
<code class="function">XtIsShell</code>,
<code class="function">XtIsOverrideShell</code>,
<code class="function">XtIsWMShell</code>,
<code class="function">XtIsVendorShell</code>,
<code class="function">XtIsTransientShell</code>,
<code class="function">XtIsTopLevelShell</code>,
<code class="function">XtIsApplicationShell</code>,
and
<code class="function">XtIsSessionShell</code>.
</p><p>
All these macros and functions have the same argument description.
</p><div class="funcsynopsis"><a id="XtIs"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtIs</strong>(</code>Widget<var class="pdparam"> w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget or object instance whose class is to be checked. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
These procedures may be faster than calling
<a class="xref" href="#XtIsSubclass"><code class="function">XtIsSubclass</code></a>
directly for the built-in classes.
</p><p>
To check a widget's class
and to generate a debugging error message, use
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>,
defined in
<code class="function"><X11/IntrinsicP.h></code>:
</p><div class="funcsynopsis"><a id="XtCheckSubclass"></a><p><code class="funcdef">void <strong class="fsfunc">XtCheckSubclass</strong>(</code>Widget<var class="pdparam"> w</var>, WidgetClass<var class="pdparam"> widget_class</var>, String<var class="pdparam"> message</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget or object whose class is to be checked. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class for which to test. Must be <span class="strong"><strong>objectClass</strong></span> or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>message</em></span>
</span></p></td><td><p>
Specifies the message to be used.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>
macro determines if the class of the specified widget is equal to
or is a subclass of the specified class.
The widget's class can be any number of subclasses down the chain
and need not be an immediate subclass of the specified class.
If the specified widget's class is not a subclass,
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>
constructs an error message from the supplied message,
the widget's actual class, and the expected class and calls
<a class="xref" href="#XtErrorMsg"><code class="function">XtErrorMsg</code></a>.
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>
should be used at the entry point of exported routines to ensure
that the client has passed in a valid widget class for the exported operation.
</p><p>
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>
is only executed when the module has been compiled with the compiler symbol
DEBUG defined; otherwise, it is defined as the empty string
and generates no code.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Superclass_Chaining"></a>Superclass Chaining</h3></div></div></div><p>
While most fields in a widget class structure are self-contained,
some fields are linked to their corresponding fields in their superclass
structures.
With a linked field,
the Intrinsics access the field's value only after accessing its corresponding
superclass value (called downward superclass chaining) or
before accessing its corresponding superclass value (called upward superclass
chaining). The self-contained fields are</p><div class="literallayout"><p><br />
In all widget classes: <span class="emphasis"><em>class_name</em></span><br />
<span class="emphasis"><em>class_initialize</em></span><br />
<span class="emphasis"><em>widget_size</em></span><br />
<span class="emphasis"><em>realize</em></span><br />
<span class="emphasis"><em>visible_interest</em></span><br />
<span class="emphasis"><em>resize</em></span><br />
<span class="emphasis"><em>expose</em></span><br />
<span class="emphasis"><em>accept_focus</em></span><br />
<span class="emphasis"><em>compress_motion</em></span><br />
<span class="emphasis"><em>compress_exposure</em></span><br />
<span class="emphasis"><em>compress_enterleave</em></span><br />
<span class="emphasis"><em>set_values_almost</em></span><br />
<span class="emphasis"><em>tm_table</em></span><br />
<span class="emphasis"><em>version</em></span><br />
<span class="emphasis"><em>allocate</em></span><br />
<span class="emphasis"><em>deallocate</em></span><br />
<br />
In Composite widget classes: <span class="emphasis"><em>geometry_manager</em></span><br />
<span class="emphasis"><em>change_managed</em></span><br />
<span class="emphasis"><em>insert_child</em></span><br />
<span class="emphasis"><em>delete_child</em></span><br />
<span class="emphasis"><em>accepts_objects</em></span><br />
<span class="emphasis"><em>allows_change_managed_set</em></span><br />
<br />
In Constraint widget classes: <span class="emphasis"><em>constraint_size</em></span><br />
<br />
In Shell widget classes: <span class="emphasis"><em>root_geometry_manager</em></span><br />
</p></div><p>
With downward superclass chaining,
the invocation of an operation first accesses the field from the
Object,
RectObj,
and
Core
class structures, then from the subclass structure, and so on down the class chain to
that widget's class structure. These superclass-to-subclass fields are
</p><div class="literallayout"><p><br />
<span class="emphasis"><em>class_part_initialize</em></span><br />
<span class="emphasis"><em>get_values_hook</em></span><br />
<span class="emphasis"><em>initialize</em></span><br />
<span class="emphasis"><em>initialize_hook</em></span><br />
<span class="emphasis"><em>set_values</em></span><br />
<span class="emphasis"><em>set_values_hook</em></span><br />
<span class="emphasis"><em>resources</em></span><br />
</p></div><p>
In addition, for subclasses of
Constraint,
the following fields of the
<code class="function">ConstraintClassPart</code>
and
<code class="function">ConstraintClassExtensionRec</code>
structures are chained from the
Constraint
class down to the subclass:
</p><div class="literallayout"><p><br />
<span class="emphasis"><em>resources</em></span><br />
<span class="emphasis"><em>initialize</em></span><br />
<span class="emphasis"><em>set_values</em></span><br />
<span class="emphasis"><em>get_values_hook</em></span><br />
</p></div><p>
With upward superclass chaining,
the invocation of an operation first accesses the field from the widget
class structure, then from the superclass structure,
and so on up the class chain to the
Core,
RectObj,
and
Object
class structures.
The subclass-to-superclass fields are
</p><div class="literallayout"><p><br />
<span class="emphasis"><em>destroy</em></span><br />
<span class="emphasis"><em>actions</em></span><br />
</p></div><p>
For subclasses of
Constraint,
the following field of
<code class="function">ConstraintClassPart</code>
is chained from the subclass up to the
Constraint class:
<span class="emphasis"><em>destroy</em></span>
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Class_Initialization_class_initialize_and_class_part_initialize_Procedures"></a>Class Initialization: class_initialize and class_part_initialize Procedures</h3></div></div></div><p>
Many class records can be initialized completely at compile or link time.
In some cases, however,
a class may need to register type converters or perform other sorts of
once-only runtime initialization.
</p><p>
Because the C language does not have initialization procedures
that are invoked automatically when a program starts up,
a widget class can declare a class_initialize procedure
that will be automatically called exactly once by the Intrinsics.
A class initialization procedure pointer is of type
<code class="function">XtProc</code>:
</p><p>
typedef void (*XtProc)(void);
</p><p>
A widget class indicates that it has no class initialization procedure by
specifying NULL in the <span class="emphasis"><em>class_initialize</em></span> field.
</p><p>
In addition to the class initialization that is done exactly once,
some classes perform initialization for fields in their parts
of the class record.
These are performed not just for the particular class,
but for subclasses as well, and are
done in the class's class part initialization procedure,
a pointer to which is stored in the <span class="emphasis"><em>class_part_initialize</em></span> field.
The class_part_initialize procedure pointer is of type
<code class="function">XtWidgetClassProc</code>.
</p><div class="funcsynopsis"><p><code class="funcdef">void <strong class="fsfunc">(*XtWidgetClassProc)(WidgetClass)</strong>(</code>WidgetClass<var class="pdparam"> widget_class</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Points to the class structure for the class being initialized.
</p></td></tr></tbody></table></div><p>
During class initialization,
the class part initialization procedures for the class and all its superclasses
are called in superclass-to-subclass order on the class record.
These procedures have the responsibility of doing any dynamic initializations
necessary to their class's part of the record.
The most common is the resolution of any inherited methods defined in the
class.
For example,
if a widget class C has superclasses
Core,
Composite,
A, and B, the class record for C first is passed to
Core 's
class_part_initialize procedure.
This resolves any inherited Core methods and compiles the textual
representations of the resource list and action table that are defined in the
class record.
Next, Composite's
class_part_initialize procedure is called to initialize the
composite part of C's class record.
Finally, the class_part_initialize procedures for A, B, and C, in that order,
are called.
For further information,
see <a class="xref" href="#Initializing_a_Widget_Class" title="Initializing a Widget Class">the section called “Initializing a Widget Class”</a>
Classes that do not define any new class fields
or that need no extra processing for them can specify NULL
in the <span class="emphasis"><em>class_part_initialize</em></span> field.
</p><p>
All widget classes, whether they have a class initialization procedure or not,
must start with their <span class="emphasis"><em>class_inited</em></span> field
<code class="function">False</code>.
</p><p>
The first time a widget of a class is created,
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
ensures that the widget class and all superclasses are initialized, in
superclass-to-subclass order, by checking each <span class="emphasis"><em>class_inited</em></span> field and,
if it is
<code class="function">False</code>,
by calling the class_initialize and the class_part_initialize procedures
for the class and all its superclasses.
The Intrinsics then set the <span class="emphasis"><em>class_inited</em></span> field to a nonzero value.
After the one-time initialization,
a class structure is constant.
</p><p>
The following example provides the class initialization procedure for a Label class.
</p><div class="literallayout"><p><br />
static void ClassInitialize()<br />
{<br />
XtSetTypeConverter(XtRString, XtRJustify, CvtStringToJustify,<br />
NULL, 0, XtCacheNone, NULL);<br />
}<br />
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Initializing_a_Widget_Class"></a>Initializing a Widget Class</h3></div></div></div><p>
A class is initialized when the first widget of that class or any
subclass is created.
To initialize a widget class without creating any widgets, use
<a class="xref" href="#XtInitializeWidgetClass"><code class="function">XtInitializeWidgetClass</code></a>.
</p><div class="funcsynopsis"><a id="XtInitializeWidgetClass"></a><p><code class="funcdef">void <strong class="fsfunc">XtInitializeWidgetClass</strong>(</code>WidgetClass<var class="pdparam"> object_class</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object_class</em></span>
</span></p></td><td><p>
Specifies the object class to initialize. May be
<code class="function">objectClass</code>
or any subclass thereof.
</p></td></tr></tbody></table></div><p>
If the specified widget class is already initialized,
<a class="xref" href="#XtInitializeWidgetClass"><code class="function">XtInitializeWidgetClass</code></a>
returns immediately.
</p><p>
If the class initialization procedure registers type converters,
these type converters are not available until the first object
of the class or subclass is created or
<a class="xref" href="#XtInitializeWidgetClass"><code class="function">XtInitializeWidgetClass</code></a>
is called
(see <a class="xref" href="#Resource_Conversions" title="Resource Conversions">the section called “Resource Conversions”</a>).
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Inheritance_of_Superclass_Operations"></a>Inheritance of Superclass Operations</h3></div></div></div><p>
A widget class is free to use any of its superclass's self-contained
operations rather than implementing its own code.
The most frequently inherited operations are
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
expose
</p></li><li class="listitem"><p>
realize
</p></li><li class="listitem"><p>
insert_child
</p></li><li class="listitem"><p>
delete_child
</p></li><li class="listitem"><p>
geometry_manager
</p></li><li class="listitem"><p>
set_values_almost
</p></li></ul></div><p>
To inherit an operation <span class="emphasis"><em>xyz</em></span>,
specify the constant
<code class="function">XtInherit</code> <span class="emphasis"><em>Xyz</em></span>
in your class record.
</p><p>
Every class that declares a new procedure in its widget class part must
provide for inheriting the procedure in its class_part_initialize
procedure.
The chained operations declared in Core
and Constraint
records are never inherited.
Widget classes that do nothing beyond what their superclass does
specify NULL for chained procedures
in their class records.
</p><p>
Inheriting works by comparing the value of the field with a known, special
value and by copying in the superclass's value for that field if a match
occurs.
This special value, called the inheritance constant,
is usually the Intrinsics internal value
<code class="function">_XtInherit</code>
cast to the appropriate type.
<code class="function">_XtInherit</code>
is a procedure that issues an error message if it is actually called.
</p><p>
For example,
<code class="function">CompositeP.h</code>
contains these definitions:
</p><div class="literallayout"><p><br />
#define XtInheritGeometryManager ((XtGeometryHandler) _XtInherit)<br />
#define XtInheritChangeManaged ((XtWidgetProc) _XtInherit)<br />
#define XtInheritInsertChild ((XtArgsProc) _XtInherit)<br />
#define XtInheritDeleteChild ((XtWidgetProc) _XtInherit)<br />
</p></div><p>
Composite's class_part_initialize procedure begins as follows:
</p><div class="literallayout"><p><br />
static void CompositeClassPartInitialize(widgetClass)<br />
WidgetClass widgetClass;<br />
{<br />
CompositeWidgetClass wc = (CompositeWidgetClass)widgetClass;<br />
CompositeWidgetClass super = (CompositeWidgetClass)wc->core_class.superclass;<br />
if (wc->composite_class.geometry_manager == XtInheritGeometryManager) {<br />
wc->composite_class.geometry_manager = super->composite_class.geometry_manager;<br />
}<br />
if (wc->composite_class.change_managed == XtInheritChangeManaged) {<br />
wc->composite_class.change_managed = super->composite_class.change_managed;<br />
}<br />
.<br />
.<br />
.<br />
</p></div><p>
Nonprocedure fields may be inherited in the same manner as procedure
fields. The class may declare any reserved value it wishes for
the inheritance constant for its new fields. The following inheritance
constants are defined:
</p><p>
For Object:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<code class="function">XtInheritAllocate</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritDeallocate</code>
</p></li></ul></div><p>
For Core:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<code class="function">XtInheritRealize</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritResize</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritExpose</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritSetValuesAlmost</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritAcceptFocus</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritQueryGeometry</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritTranslations</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritDisplayAccelerator</code>
</p></li></ul></div><p>
For Composite:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<code class="function">XtInheritGeometryManager</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritChangeManaged</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritInsertChild</code>
</p></li><li class="listitem"><p>
<code class="function">XtInheritDeleteChild</code>
</p></li></ul></div><p>
For Shell:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<code class="function">XtInheritRootGeometryManager</code>
</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Invocation_of_Superclass_Operations"></a>Invocation of Superclass Operations</h3></div></div></div><p>
A widget sometimes needs to call a superclass operation
that is not chained.
For example,
a widget's expose procedure might call its superclass's <span class="emphasis"><em>expose</em></span>
and then perform a little more work on its own.
For example, a Composite
class with predefined managed children can implement insert_child
by first calling its superclass's <span class="emphasis"><em>insert_child</em></span>
and then calling
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>
to add the child to the managed set.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
A class method should not use
<code class="function">XtSuperclass</code>
but should instead call the class method of its own specific superclass
directly through the superclass record.
That is, it should use its own class pointers only,
not the widget's class pointers,
as the widget's class may be a subclass of the
class whose implementation is being referenced.
</p></div><p>
This technique is referred to as <span class="emphasis"><em>enveloping</em></span> the superclass's operation.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Class_Extension_Records"></a>Class Extension Records</h3></div></div></div><p>
It may be necessary at times to add new fields to already existing
widget class structures. To permit this to be done without requiring
recompilation of all subclasses, the last field in a class part structure
should be an extension pointer. If no extension fields for a class
have yet been defined, subclasses should initialize the value of the
extension pointer to NULL.
</p><p>
If extension fields exist, as is the case with the
Composite,
Constraint,
and
Shell
classes, subclasses can provide values for these fields by setting the
<span class="emphasis"><em>extension</em></span> pointer for the appropriate part in their class structure to
point to a statically declared extension record containing the
additional fields.
Setting the <span class="emphasis"><em>extension</em></span> field is never mandatory; code that uses fields
in the extension record must always check the <span class="emphasis"><em>extension</em></span> field and take
some appropriate default action if it is NULL.
</p><p>
In order to permit multiple subclasses and libraries to chain extension
records from a single <span class="emphasis"><em>extension</em></span> field, extension records should be
declared as a linked list, and each extension record definition should
contain the following four fields at the beginning of the structure
declaration:
</p><div class="literallayout"><p><br />
struct {<br />
XtPointer next_extension;<br />
XrmQuark record_type;<br />
long version;<br />
Cardinal record_size;<br />
};<br />
</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>next_extension</em></span>
</span></p></td><td><p>
Specifies the next record in the list, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>record_type</em></span>
</span></p></td><td><p>
Specifies the particular structure declaration to which
each extension record instance conforms.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>version</em></span>
</span></p></td><td><p>
Specifies a version id symbolic constant supplied by
the definer of the structure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>record_size</em></span>
</span></p></td><td><p>
Specifies the total number of bytes allocated for the
extension record.
</p></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>record_type</em></span> field identifies the contents of the extension record
and is used by the definer of the record to locate its particular
extension record in the list. The
<span class="emphasis"><em>record_type</em></span> field is normally assigned the
result of
<code class="function">XrmStringToQuark</code>
for a registered string constant. The
Intrinsics reserve all record type strings beginning with the two
characters ``XT'' for future standard uses. The value
<span class="strong"><strong>NULLQUARK</strong></span>
may also be used
by the class part owner in extension records attached to its own class
part extension field to identify the extension record unique to that
particular class.
</p><p>
The <span class="emphasis"><em>version</em></span> field is an owner-defined constant that may be used to
identify binary files that have been compiled with alternate
definitions of the remainder of the extension record data structure. The private
header file for a widget class should provide a symbolic constant for
subclasses to use to initialize this field.
The <span class="emphasis"><em>record_size</em></span> field value includes the four common header fields and
should normally be initialized with
<code class="function">sizeof ().</code>
</p><p>
Any value stored in the class part extension fields of
<code class="function">CompositeClassPart</code>,
<code class="function">ConstraintClassPart</code>,
or
<code class="function">ShellClassPart</code>
must point to an extension record conforming to this definition.
</p><p>
The Intrinsics provide a utility function for widget writers to locate a
particular class extension record in a linked list, given a widget class
and the offset of the <span class="emphasis"><em>extension</em></span> field in the class record.
</p><p>
To locate a class extension record, use
<a class="xref" href="#XtGetClassExtension"><code class="function">XtGetClassExtension</code></a>.
</p><div class="funcsynopsis"><a id="XtGetClassExtension"></a><p><code class="funcdef">XtPointer <strong class="fsfunc">XtGetClassExtension</strong>(</code>WidgetClass<var class="pdparam"> object_class</var>, Cardinal<var class="pdparam"> byte_offset</var>, XrmQuark<var class="pdparam"> type</var>, long<var class="pdparam"> version</var>, Cardinal<var class="pdparam"> record_size</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object_class</em></span>
</span></p></td><td><p>
Specifies the object class containing the extension list to be searched.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>byte_offset</em></span>
</span></p></td><td><p>
Specifies the offset in bytes from the base of the
class record of the extension field to be searched.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the record_type of the class extension to be located.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>version</em></span>
</span></p></td><td><p>
Specifies the minimum acceptable version of the class
extension required for a match.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>record_size</em></span>
</span></p></td><td><p>
Specifies the minimum acceptable length of the class
extension record required for a match, or 0.
</p></td></tr></tbody></table></div><p>
The list of extension records at the specified offset in the specified
object class will be searched for a match on the specified type,
a version greater than or equal to the specified version, and a record
size greater than or equal the specified record_size if it is nonzero.
<a class="xref" href="#XtGetClassExtension"><code class="function">XtGetClassExtension</code></a>
returns a pointer to a matching extension record or NULL if no match
is found. The returned extension record must not be modified or
freed by the caller if the caller is not the extension owner.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Widget_Instantiation"></a>Chapter 2. Widget Instantiation</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Initializing_the_tk">Initializing the X Toolkit</a></span></dt><dt><span class="sect1"><a href="#Establishing_the_Locale">Establishing the Locale</a></span></dt><dt><span class="sect1"><a href="#Loading_the_Resource_Database">Loading the Resource Database</a></span></dt><dt><span class="sect1"><a href="#Parsing_the_Command_Line">Parsing the Command Line</a></span></dt><dt><span class="sect1"><a href="#Creating_Widgets">Creating Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Creating_and_Merging_Argument_Lists">Creating and Merging Argument Lists</a></span></dt><dt><span class="sect2"><a href="#Creating_a_Widget_Instance">Creating a Widget Instance</a></span></dt><dt><span class="sect2"><a href="#Creating_an_Application_Shell_Instance">Creating an Application Shell Instance</a></span></dt><dt><span class="sect2"><a href="#Convenience_Procedure_to_Initialize_an_Application">Convenience Procedure to Initialize an Application</a></span></dt><dt><span class="sect2"><a href="#Widget_Instance_Allocation_The_allocate_Procedure">Widget Instance Allocation: The allocate Procedure</a></span></dt><dt><span class="sect2"><a href="#Widget_Instance_Initialization_The_initialize_Procedure">Widget Instance Initialization: The initialize Procedure</a></span></dt><dt><span class="sect2"><a href="#Constraint_Instance_Initialization_The_ConstraintClassPart_initialize_Procedure">Constraint Instance Initialization: The ConstraintClassPart initialize Procedure</a></span></dt><dt><span class="sect2"><a href="#Nonwidget_Data_Initialization_The_initialize_hook_Procedure">Nonwidget Data Initialization: The initialize_hook Procedure</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Realizing_Widgets">Realizing Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Widget_Instance_Window_Creation_The_realize_Procedure">Widget Instance Window Creation: The realize Procedure</a></span></dt><dt><span class="sect2"><a href="#Window_Creation_Convenience_Routine">Window Creation Convenience Routine</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Obtaining_Window_Information_from_a_Widget">Obtaining Window Information from a Widget</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Unrealizing_Widgets">Unrealizing Widgets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Destroying_Widgets">Destroying Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Adding_and_Removing_Destroy_Callbacks">Adding and Removing Destroy Callbacks</a></span></dt><dt><span class="sect2"><a href="#Dynamic_Data_Deallocation_The_destroy_Procedure">Dynamic Data Deallocation: The destroy Procedure</a></span></dt><dt><span class="sect2"><a href="#Dynamic_Constraint_Data_Deallocation_The_ConstraintClassPart_destroy_Procedure">Dynamic Constraint Data Deallocation: The ConstraintClassPart destroy Procedure</a></span></dt><dt><span class="sect2"><a href="#Widget_Instance_Deallocation_The_deallocate_Procedure">Widget Instance Deallocation: The deallocate Procedure</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Exiting_from_an_Application">Exiting from an Application</a></span></dt></dl></div><p>
A hierarchy of widget instances constitutes a widget tree.
The shell widget returned by
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
is the root of the widget tree instance.
The widgets with one or more children are the intermediate nodes of that tree,
and the widgets with no children of any kind are the leaves of the widget tree.
With the exception of pop-up children (see <a class="xref" href="#Pop_Up_Widgets" title="Chapter 5. Pop-Up Widgets">Chapter 5, <em>Pop-Up Widgets</em></a>),
this widget tree instance defines the associated X Window tree.
</p><p>
Widgets can be either composite or primitive.
Both kinds of widgets can contain children,
but the Intrinsics provide a set of management mechanisms for constructing
and interfacing between composite widgets, their children, and
other clients.
</p><p>
Composite widgets, that is, members of the class
<code class="function">compositeWidgetClass</code>,
are containers for an arbitrary,
but widget implementation-defined, collection of children,
which may be instantiated by the composite widget itself,
by other clients, or by a combination of the two.
Composite widgets also contain methods for managing the geometry (layout)
of any child widget.
Under unusual circumstances,
a composite widget may have zero children,
but it usually has at least one.
By contrast,
primitive widgets that contain children typically instantiate
specific children of known classes themselves and do not expect external
clients to do so.
Primitive widgets also do not have general geometry management methods.
</p><p>
In addition,
the Intrinsics recursively perform many operations
(for example, realization and destruction)
on composite widgets and all their children.
Primitive widgets that have children must be prepared
to perform the recursive operations themselves on behalf of their children.
</p><p>
A widget tree is manipulated by several Intrinsics functions.
For example,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
traverses the tree downward and recursively realizes all
pop-up widgets and children of composite widgets.
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
traverses the tree downward and destroys all pop-up widgets
and children of composite widgets.
The functions that fetch and modify resources traverse the tree upward
and determine the inheritance of resources from a widget's ancestors.
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
traverses the tree up one level and calls the geometry manager
that is responsible for a widget child's geometry.
</p><p>
To facilitate upward traversal of the widget tree,
each widget has a pointer to its parent widget.
The
Shell
widget that
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
returns has a <span class="emphasis"><em>parent</em></span> pointer of NULL.
</p><p>
To facilitate downward traversal of the widget tree,
the <span class="emphasis"><em>children</em></span> field of
each composite widget is a pointer to an array of child widgets,
which includes all normal children created,
not just the subset of children that are managed by the composite widget's
geometry manager.
Primitive widgets
that instantiate children are entirely responsible for all operations
that require downward traversal below themselves.
In addition,
every widget has a pointer to an array of pop-up children.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Initializing_the_tk"></a>Initializing the X Toolkit</h2></div></div></div><p>
Before an application can call any Intrinsics function
other than
<code class="function">XtSetLanguageProc</code>
and
<a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a>,
it must initialize the Intrinsics by using
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>,
which initializes the Intrinsics internals
</p></li><li class="listitem"><p>
<a class="xref" href="#XtCreateApplicationContext"><code class="function">XtCreateApplicationContext</code></a>,
which initializes the per-application state
</p></li><li class="listitem"><p>
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
or
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>,
which initializes the per-display state
</p></li><li class="listitem"><p>
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>,
which creates the root of a widget tree
</p></li></ul></div><p>
Or an application can call the convenience procedure
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>,
which combines the functions of the preceding procedures.
An application wishing to use the ANSI C locale mechanism should call
<code class="function">XtSetLanguageProc</code>
prior to calling
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>,
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>,
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>,
or
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>.
</p><p>
Multiple instances of X Toolkit applications may be implemented
in a single address space.
Each instance needs to be able to read
input and dispatch events independently of any other instance.
Further, an application instance may need multiple display connections
to have widgets on multiple displays.
From the application's point of view, multiple display connections
usually are treated together as a single unit
for purposes of event dispatching.
To accommodate both requirements,
the Intrinsics define application contexts,
each of which provides the information needed to distinguish one application
instance from another.
The major component of an application context is a list of one or more X
<code class="function">Display</code>
pointers for that application.
The Intrinsics handle all display connections within a single application
context simultaneously, handling input in a round-robin fashion.
The application context type
<code class="function">XtAppContext</code>
is opaque to clients.
</p><p>
To initialize the Intrinsics internals, use
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>.
</p><div class="funcsynopsis"><a id="XtToolkitInitialize"></a><p><code class="funcdef">void <strong class="fsfunc">XtToolkitInitialize</strong>(</code> <var class="pdparam"></var><code>)</code>;</p></div><p>
If
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>
was previously called, it returns immediately.
When
<a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a>
is called before
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>,
the latter is protected against
simultaneous activation by multiple threads.
</p><p>
To create an application context, use
<a class="xref" href="#XtCreateApplicationContext"><code class="function">XtCreateApplicationContext</code></a>.
</p><div class="funcsynopsis"><a id="XtCreateApplicationContext"></a><p><code class="funcdef">XtAppContext <strong class="fsfunc">XtCreateApplicationContext</strong>(</code> <var class="pdparam"></var><code>)</code>;</p></div><p>
The
<a class="xref" href="#XtCreateApplicationContext"><code class="function">XtCreateApplicationContext</code></a>
function returns an application context,
which is an opaque type.
Every application must have at least one application context.
</p><p>
To destroy an application context and close any
remaining display connections in it, use
<a class="xref" href="#XtDestroyApplicationContext"><code class="function">XtDestroyApplicationContext</code></a>.
</p><div class="funcsynopsis"><a id="XtDestroyApplicationContext"></a><p><code class="funcdef">void <strong class="fsfunc">XtDestroyApplicationContext</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDestroyApplicationContext"><code class="function">XtDestroyApplicationContext</code></a>
function destroys the specified application context.
If called from within an event dispatch (for example, in a callback procedure),
<a class="xref" href="#XtDestroyApplicationContext"><code class="function">XtDestroyApplicationContext</code></a>
does not destroy the application context until the dispatch is complete.
</p><p>
To get the application context in which a given widget was created, use
<a class="xref" href="#XtWidgetToApplicationContext"><code class="function">XtWidgetToApplicationContext</code></a>.
</p><div class="funcsynopsis"><a id="XtWidgetToApplicationContext"></a><p><code class="funcdef">XtAppContext <strong class="fsfunc">XtWidgetToApplicationContext</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which you want the application context. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtWidgetToApplicationContext"><code class="function">XtWidgetToApplicationContext</code></a>
function returns the application context for the specified widget.
</p><p>
To initialize a display and add it to an application context, use
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>.
</p><div class="funcsynopsis"><a id="XtDisplayInitialize"></a><p><code class="funcdef">void <strong class="fsfunc">XtDisplayInitialize</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, Display * <var class="pdparam">display</var>, String <var class="pdparam">application_name</var>, String <var class="pdparam">application_class</var>, XrmOptionDescRec * <var class="pdparam">options</var>, Cardinal <var class="pdparam">num_options</var>, int * <var class="pdparam">argc</var>, String * <var class="pdparam">argv</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies a previously opened display connection. Note that a single
display connection can be in at most one application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_name</em></span>
</span></p></td><td><p>
Specifies the name of the application instance.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the class name of this application,
which is usually the generic name for all instances of this application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>options</em></span>
</span></p></td><td><p>
Specifies how to parse the command line for any application-specific resources.
The <span class="emphasis"><em>options</em></span> argument is passed as a parameter to
<code class="function">XrmParseCommand</code>.
For further information,
see <span class="olink">Parsing Command Line Options</span> in <span class="olink">Xlib — C Language X Interface</span> and <a class="xref" href="#Parsing_the_Command_Line" title="Parsing the Command Line">the section called “Parsing the Command Line”</a> of this specification.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_options</em></span>
</span></p></td><td><p>
Specifies the number of entries in the options list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argc</em></span>
</span></p></td><td><p>
Specifies a pointer to the number of command line parameters.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argv</em></span>
</span></p></td><td><p>
Specifies the list of command line parameters.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
function retrieves the language string to be
used for the specified display (see <a class="xref" href="#Finding_File_Names" title="Finding File Names">the section called “Finding File Names”</a>),
calls the language procedure (if set) with that language string,
builds the resource database for the default screen, calls the Xlib
<code class="function">XrmParseCommand</code>
function to parse the command line,
and performs other per-display initialization.
After
<code class="function">XrmParseCommand</code>
has been called,
<span class="emphasis"><em>argc</em></span> and <span class="emphasis"><em>argv</em></span> contain only those parameters that
were not in the standard option table or in the table specified by the
<span class="emphasis"><em>options</em></span> argument.
If the modified <span class="emphasis"><em>argc</em></span> is not zero,
most applications simply print out the modified <span class="emphasis"><em>argv</em></span> along with a message
listing the allowable options.
On POSIX-based systems,
the application name is usually the final component of <span class="emphasis"><em>argv</em></span>[0].
If the synchronous resource is
<code class="function">True</code>,
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
calls the Xlib
<code class="function">XSynchronize</code>
function to put Xlib into synchronous mode for this display connection
and any others currently open in the application context.
See <a class="xref" href="#Loading_the_Resource_Database" title="Loading the Resource Database">the section called “Loading the Resource Database”</a>
and <a class="xref" href="#Parsing_the_Command_Line" title="Parsing the Command Line">the section called “Parsing the Command Line”</a>
for details on the <span class="emphasis"><em>application_name</em></span>,
<span class="emphasis"><em>application_class</em></span>, <span class="emphasis"><em>options</em></span>, and <span class="emphasis"><em>num_options</em></span> arguments.
</p><p>
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
calls
<code class="function">XrmSetDatabase</code>
to associate the resource database of the default screen with the
display before returning.
</p><p>
To open a display, initialize it, and then
add it to an application context, use
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>.
</p><div class="funcsynopsis"><a id="XtOpenDisplay"></a><p><code class="funcdef">Display <strong class="fsfunc">*XtOpenDisplay</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">display_string</var>, String <var class="pdparam">application_name</var>, String <var class="pdparam">application_class</var>, XrmOptionDescRec * <var class="pdparam">options</var>, Cardinal <var class="pdparam">num_options</var>, int * <var class="pdparam">argc</var>, String * <var class="pdparam">argv</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>display_string</em></span>
</span></p></td><td><p>
Specifies the display string, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_name</em></span>
</span></p></td><td><p>
Specifies the name of the application instance, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the class name of this application,
which is usually the generic name for all instances of this application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>options</em></span>
</span></p></td><td><p>
Specifies how to parse the command line for any application-specific resources.
The options argument is passed as a parameter to
<code class="function">XrmParseCommand</code>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_options</em></span>
</span></p></td><td><p>
Specifies the number of entries in the options list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argc</em></span>
</span></p></td><td><p>
Specifies a pointer to the number of command line parameters.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argv</em></span>
</span></p></td><td><p>
Specifies the list of command line parameters.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
function calls
<code class="function">XOpenDisplay</code>
with the specified <span class="emphasis"><em>display_string</em></span>.
If <span class="emphasis"><em>display_string</em></span> is NULL,
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
uses the current value of the \-display option specified in <span class="emphasis"><em>argv</em></span>.
If no display is specified in <span class="emphasis"><em>argv</em></span>,
the user's default display is retrieved from the environment.
On POSIX-based systems,
this is the value of the
<span class="strong"><strong>DISPLAY</strong></span>
environment variable.
</p><p>
If this succeeds,
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
then calls
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
and passes it the opened display and
the value of the \-name option specified in <span class="emphasis"><em>argv</em></span> as the application name.
If no \-name option is specified
and <span class="emphasis"><em>application_name</em></span> is
non-NULL, <span class="emphasis"><em>application_name</em></span> is passed to
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>.
If <span class="emphasis"><em>application_name</em></span> is NULL and if the environment variable
<span class="strong"><strong>RESOURCE_NAME</strong></span>
is set, the value of
<span class="strong"><strong>RESOURCE_NAME</strong></span>
is used. Otherwise, the application
name is the name used to invoke the program. On implementations that
conform to ANSI C Hosted Environment support, the application name will
be <span class="emphasis"><em>argv</em></span>[0] less any directory and file type components, that is, the
final component of <span class="emphasis"><em>argv</em></span>[0], if specified. If <span class="emphasis"><em>argv</em></span>[0] does not exist or
is the empty string, the application name is ``main''.
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
returns the newly opened display or NULL if it failed.
</p><p>
See <a class="xref" href="#Using_the_Intrinsics_in_a_Multi_Threaded_Environment" title="Using the Intrinsics in a Multi-Threaded Environment">the section called “Using the Intrinsics in a Multi-Threaded Environment”</a>
for information regarding the use of
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
in multiple threads.
</p><p>
To close a display and remove it from an application context, use
<a class="xref" href="#XtCloseDisplay"><code class="function">XtCloseDisplay</code></a>.
</p><div class="funcsynopsis"><a id="XtCloseDisplay"></a><p><code class="funcdef">void <strong class="fsfunc">XtCloseDisplay</strong>(</code>Display * <var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCloseDisplay"><code class="function">XtCloseDisplay</code></a>
function calls
<code class="function">XCloseDisplay</code>
with the specified <span class="emphasis"><em>display</em></span> as soon as it is safe to do so.
If called from within an event dispatch (for example, a callback procedure),
<a class="xref" href="#XtCloseDisplay"><code class="function">XtCloseDisplay</code></a>
does not close the display until the dispatch is complete.
Note that applications need only call
<a class="xref" href="#XtCloseDisplay"><code class="function">XtCloseDisplay</code></a>
if they are to continue executing after closing the display;
otherwise, they should call
<a class="xref" href="#XtDestroyApplicationContext"><code class="function">XtDestroyApplicationContext</code></a>.
</p><p>
See <a class="xref" href="#Using_the_Intrinsics_in_a_Multi_Threaded_Environment" title="Using the Intrinsics in a Multi-Threaded Environment">the section called “Using the Intrinsics in a Multi-Threaded Environment”</a>
for information regarding the use of
<a class="xref" href="#XtCloseDisplay"><code class="function">XtCloseDisplay</code></a>
in multiple threads.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Establishing_the_Locale"></a>Establishing the Locale</h2></div></div></div><p>
Resource databases are specified to be created in the current process
locale. During display initialization prior to creating the
per-screen resource database, the Intrinsics will call out to a specified
application procedure to set the locale according to options found on
the command line or in the per-display resource specifications.
</p><p>
The callout procedure provided by the application is of type
<code class="function">XtLanguageProc</code>.
</p><div class="funcsynopsis"><p><code class="funcdef">typedef String <strong class="fsfunc">(*XtLanguageProc)</strong>(</code>Display <var class="pdparam">display</var>, String <var class="pdparam">language</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Passes the display.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>language</em></span>
</span></p></td><td><p>
Passes the initial language value obtained from the command line
or server per-display resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Passes the additional client data specified in the call to
<code class="function">XtSetLanguageProc</code>.
</p></td></tr></tbody></table></div><p>
The language procedure allows an application to set the locale to
the value of the language resource determined by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>.
The function returns a new language string that
will be subsequently used by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
to establish the path for loading resource files. The returned
string will be copied by the Intrinsics into new memory.
</p><p>
Initially, no language procedure is set by the Intrinsics.
To set the language procedure for use by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>,
use
<code class="function">XtSetLanguageProc</code>.
</p><div class="funcsynopsis"><p><code class="funcdef">XtLanguageProc <strong class="fsfunc">XtSetLanguageProc</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtLanguageProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context in which the language procedure is
to be used, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the language procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional client data to be passed to the language
procedure when it is called.
</p></td></tr></tbody></table></div><p>
<code class="function">XtSetLanguageProc</code>
sets the language procedure that will be called from
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
for all subsequent Displays initialized in the specified application
context. If <span class="emphasis"><em>app_context</em></span> is NULL, the specified language
procedure is registered in all application contexts created by the
calling process, including any future application contexts that may
be created. If <span class="emphasis"><em>proc</em></span> is NULL, a default language procedure is
registered.
<code class="function">XtSetLanguageProc</code>
returns the previously registered language procedure.
If a language procedure has not yet been registered, the return value
is unspecified, but if this return value is used in a subsequent call to
<code class="function">XtSetLanguageProc</code>,
it will cause the default language procedure to be registered.
</p><p>
The default language procedure does the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Sets the locale according to the environment. On ANSI C-based
systems this is done by calling
<code class="function">setlocale</code>(
<code class="function">LC_ALL</code>,
<span class="emphasis"><em>language</em></span> ).
If an error is encountered, a warning message is issued with
<a class="xref" href="#XtWarning"><code class="function">XtWarning</code></a>.
</p></li><li class="listitem"><p>
Calls
<code class="function">XSupportsLocale</code>
to verify that the current locale is supported.
If the locale is not supported, a warning message is issued with
<a class="xref" href="#XtWarning"><code class="function">XtWarning</code></a>
and the locale is set to ``C''.
</p></li><li class="listitem"><p>
Calls
<code class="function">XSetLocaleModifiers</code>
specifying the empty string.
</p></li><li class="listitem"><p>
Returns the value of the current locale. On ANSI C-based systems this
is the return value from a final call to
<code class="function">setlocale</code>(
<code class="function">LC_ALL</code>,
NULL ).
</p></li></ul></div><p>
A client wishing to use this mechanism to establish locale can do so
by calling
<code class="function">XtSetLanguageProc</code>
prior to
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>,
as in the following example.
</p><div class="literallayout"><p><br />
Widget top;<br />
XtSetLanguageProc(NULL, NULL, NULL);<br />
top = XtOpenApplication(...);<br />
...<br />
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Loading_the_Resource_Database"></a>Loading the Resource Database</h2></div></div></div><p>
The
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
function first determines the language
string to be used for the specified display. It then
creates a resource database for the default screen of the display by
combining the following sources in order, with the entries in the
first named source having highest precedence:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Application command line (<span class="emphasis"><em>argc</em></span>, <span class="emphasis"><em>argv</em></span>).
</p></li><li class="listitem"><p>
Per-host user environment resource file on the local host.
</p></li><li class="listitem"><p>
Per-screen resource specifications from the server.
</p></li><li class="listitem"><p>
Per-display resource specifications from the server or from
the user preference file on the local host.
</p></li><li class="listitem"><p>
Application-specific user resource file on the local host.
</p></li><li class="listitem"><p>
Application-specific class resource file on the local host.
</p></li></ul></div><p>
When the resource database for a particular screen on the display
is needed (either internally, or when
<a class="xref" href="#XtScreenDatabase"><code class="function">XtScreenDatabase</code></a>
is called),
it is created in the following manner using the sources listed
above in the same order:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A temporary database, the ``server resource database'', is
created from the string returned by
<code class="function">XResourceManagerString</code>
or, if
<code class="function">XResourceManagerString</code>
returns NULL, the contents of a resource file in the user's home
directory. On POSIX-based systems, the usual name for this user
preference resource file is $HOME/<code class="function">.Xdefaults</code>.
</p></li><li class="listitem"><p>
If a language procedure has been set,
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
first searches the command line for the option ``-xnlLanguage'', or
for a -xrm option that specifies the xnlLanguage/XnlLanguage resource,
as specified by Section 2.4.
If such a resource is found, the value is assumed to be
entirely in XPCS, the X Portable Character Set. If neither option is
specified on the command line,
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
queries the server resource database (which is assumed to be entirely
in XPCS) for the resource
<span class="emphasis"><em>name</em></span><code class="function">.xnlLanguage</code>, class <span class="emphasis"><em>Class</em></span><code class="function">.XnlLanguage</code>
where <span class="emphasis"><em>name</em></span>
and <span class="emphasis"><em>Class</em></span> are the <span class="emphasis"><em>application_name</em></span> and
<span class="emphasis"><em>application_class</em></span> specified to
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>.
The language procedure is then invoked with
the resource value if found, else the empty string. The
string returned from the language procedure is saved for all future
references in the Intrinsics that require the per-display language string.
</p></li><li class="listitem"><p>
The screen resource database is initialized by parsing the command
line in the manner specified by Section 2.4.
</p></li><li class="listitem"><p>
If a language procedure has not been set,
the initial database is then queried for the resource
<span class="emphasis"><em>name</em></span><code class="function">.xnlLanguage</code>, class <span class="emphasis"><em>Class</em></span><code class="function">.XnlLanguage</code>
as specified above.
If this database query fails, the server resource database is
queried; if this query also fails, the language is determined from
the environment; on POSIX-based systems, this is done by retrieving the
value of the
<span class="strong"><strong>LANG</strong></span>
environment variable. If no language string is
found, the empty string is used.
This language string is saved for all future references in the Intrinsics
that require the per-display language string.
</p></li><li class="listitem"><p>
After determining the language string, the user's environment resource
file is then merged into the initial resource database if the file exists.
This file is user-, host-, and process-specific and is expected to
contain user preferences that are to override those specifications in
the per-display and per-screen resources.
On POSIX-based systems, the user's environment resource file name is
specified by the value of the
<span class="strong"><strong>XENVIRONMENT</strong></span>
environment variable.
If this environment variable does not exist, the user's home directory
is searched for a file named
<code class="function">.Xdefaults-</code><span class="emphasis"><em>host</em></span>,
where <span class="emphasis"><em>host</em></span> is the host name of the machine on which the
application is running.
</p></li><li class="listitem"><p>
The per-screen resource specifications are then merged into the screen
resource database, if they exist. These specifications are the string
returned by
<code class="function">XScreenResourceString</code>
for the respective screen and are owned entirely by the user.
</p></li><li class="listitem"><p>
Next, the server resource database created earlier is merged into the
screen resource database. The server property, and corresponding user
preference file, are owned and constructed entirely by the user.
</p></li><li class="listitem"><p>
The application-specific user resource file from the local host is
then merged into the screen resource database.
This file contains user customizations and is stored
in a directory owned by the user.
Either the user or the application or both can store resource specifications
in the file. Each should be prepared to find and respect entries made
by the other.
The file name is found by calling
<code class="function">XrmSetDatabase</code>
with the current screen resource database, after preserving the
original display-associated database, then calling
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>
with the parameters
(<span class="emphasis"><em>display</em></span>, NULL, NULL, NULL, <span class="emphasis"><em>path</em></span>, NULL, 0, NULL),
where <span class="emphasis"><em>path</em></span> is defined in an operating-system-specific way.
On POSIX-based systems, <span class="emphasis"><em>path</em></span> is defined to be the value
of the environment variable
<span class="strong"><strong>XUSERFILESEARCHPATH</strong></span>
if this is defined. If
<span class="strong"><strong>XUSERFILESEARCHPATH</strong></span>
is not defined, an implementation-dependent default value is used.
This default value is constrained in the following manner:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
If the environment variable
<span class="strong"><strong>XAPPLRESDIR</strong></span>
is not defined, the default
<span class="strong"><strong>XUSERFILESEARCHPATH</strong></span>
must contain at least six entries. These entries must contain
$HOME as the directory prefix, plus the following substitutions:
</p><div class="literallayout"><p><br />
1. %C, %N, %L or %C, %N, %l, %t, %c<br />
2. %C, %N, %l<br />
3. %C, %N<br />
4. %N, %L or %N, %l, %t, %c<br />
5. %N, %l<br />
6. %N<br />
</p></div><p>
The order of these six entries within the path must be as given above.
The order and use of substitutions within a given entry are
implementation-dependent.
</p></li><li class="listitem"><p> If
<span class="strong"><strong>XAPPLRESDIR</strong></span>
is defined, the default
<span class="strong"><strong>XUSERFILESEARCHPATH</strong></span>
must contain at least seven entries. These entries must contain the
following directory prefixes and substitutions:
</p><div class="literallayout"><p><br />
1. $XAPPLRESDIR with %C, %N, %L or %C, %N, %l, %t, %c<br />
2. $XAPPLRESDIR with %C, %N, %l<br />
3. $XAPPLRESDIR with %C, %N<br />
4. $XAPPLRESDIR with %N, %L or %N, %l, %t, %c<br />
5. $XAPPLRESDIR with %N, %l<br />
6. $XAPPLRESDIR with %N<br />
7. $HOME with %N<br />
</p></div><p>
The order of these seven entries within the path must be as given above.
The order and use of substitutions within a given entry are
implementation-dependent.
</p></li></ul></div></li><li class="listitem"><p>
Last, the application-specific class resource file from the local
host is merged into the screen resource database.
This file is owned by the application and is usually installed in
a system directory when the application is installed.
It may contain sitewide customizations specified by the system manager.
The name of the application class resource file is found by calling
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>
with the parameters
(<span class="emphasis"><em>display</em></span>, ``app-defaults'', NULL, NULL, NULL, NULL, 0, NULL).
This file is expected to be provided by the developer of the application
and may be required for the application to function properly.
A simple application that wants to be assured of having a minimal
set of resources in the absence of its class resource file can declare
fallback resource specifications with
<a class="xref" href="#XtAppSetFallbackResources"><code class="function">XtAppSetFallbackResources</code></a>.
Note that the customization substitution string is retrieved
dynamically by
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>
so that the resolved file name of the application class resource file
can be affected by any of the earlier sources for the screen resource
database, even though the contents of the class resource file have
lowest precedence. After calling
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>,
the original display-associated database is restored.
</p></li></ul></div><p>
To obtain the resource database for a particular screen, use
<a class="xref" href="#XtScreenDatabase"><code class="function">XtScreenDatabase</code></a>.
</p><div class="funcsynopsis"><a id="XtScreenDatabase"></a><p><code class="funcdef">XrmDatabase <strong class="fsfunc">XtScreenDatabase</strong>(</code>Screen * <var class="pdparam">screen</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>screen</em></span>
</span></p></td><td><p>
Specifies the screen whose resource database is to be returned.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtScreenDatabase"><code class="function">XtScreenDatabase</code></a>
function returns the fully merged resource database as specified above,
associated with the specified screen. If the specified <span class="emphasis"><em>screen</em></span>
does not belong to a
<code class="function">Display</code>
initialized by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>,
the results are undefined.
</p><p>
To obtain the default resource database associated with a particular display, use
<a class="xref" href="#XtDatabase"><code class="function">XtDatabase</code></a>.
</p><div class="funcsynopsis"><a id="XtDatabase"></a><p><code class="funcdef">XrmDatabase <strong class="fsfunc">XtDatabase</strong>(</code>Display * <var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDatabase"><code class="function">XtDatabase</code></a>
function is equivalent to
<code class="function">XrmGetDatabase</code>.
It returns the database associated with the specified display, or
NULL if a database has not been set.
</p><p>
To specify a default set of resource values that will be used to
initialize the resource database if no application-specific class
resource file is found (the last of the six sources listed above),
use
<a class="xref" href="#XtAppSetFallbackResources"><code class="function">XtAppSetFallbackResources</code></a>.
</p><div class="funcsynopsis"><a id="XtAppSetFallbackResources"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppSetFallbackResources</strong>(</code>XtAppContext * <var class="pdparam">app_context</var>, String * <var class="pdparam">specification_list</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context in which
the fallback specifications will be used.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>specification_list</em></span>
</span></p></td><td><p>
Specifies a NULL-terminated list of
resource specifications to preload
the database, or NULL.
</p></td></tr></tbody></table></div><p>
Each entry in <span class="emphasis"><em>specification_list</em></span> points to a string in the format of
<code class="function">XrmPutLineResource</code>.
Following a call to
<a class="xref" href="#XtAppSetFallbackResources"><code class="function">XtAppSetFallbackResources</code></a>,
when a resource database is being created for a particular screen and
the Intrinsics are not able
to find or read an application-specific class resource file according to the
rules given above and if <span class="emphasis"><em>specification_list</em></span> is not NULL, the
resource specifications in <span class="emphasis"><em>specification_list</em></span> will be merged
into the screen resource database in place of the application-specific
class resource file.
<a class="xref" href="#XtAppSetFallbackResources"><code class="function">XtAppSetFallbackResources</code></a>
is not
required to copy <span class="emphasis"><em>specification_list</em></span>; the caller must ensure that the
contents of the list and of the strings addressed by the list remain
valid until all displays are initialized or until
<a class="xref" href="#XtAppSetFallbackResources"><code class="function">XtAppSetFallbackResources</code></a>
is called again. The value NULL for
<span class="emphasis"><em>specification_list</em></span> removes any previous fallback resource specification
for the application context. The intended use for fallback resources
is to provide a minimal
number of resources that will make the application usable (or at
least terminate with helpful diagnostic messages) when some problem
exists in finding and loading the application defaults file.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Parsing_the_Command_Line"></a>Parsing the Command Line</h2></div></div></div><p>
The
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
function first parses the command line for the following options:
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">-display</span></p></td><td><p>
Specifies the display name for
<code class="function">XOpenDisplay</code>.
</p></td></tr><tr><td><p><span class="term">-name</span></p></td><td><p>
Sets the resource name prefix,
which overrides the application name passed to
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>.
</p></td></tr><tr><td><p><span class="term">-xnllanguage</span></p></td><td><p>
Specifies the initial language string for establishing locale
and for finding application class resource files.
</p></td></tr></tbody></table></div><p>
</p><p>
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
has a table of standard command line options that are passed to
<code class="function">XrmParseCommand</code>
for adding resources to the resource database,
and it takes as a parameter additional
application-specific resource abbreviations.
The format of this table is described in Section 15.9 in <span class="emphasis"><em>Xlib — C Language X Interface</em></span>.
</p><div class="literallayout"><p><br />
typedef enum {<br />
XrmoptionNoArg, /* Value is specified in OptionDescRec.value */<br />
XrmoptionIsArg, /* Value is the option string itself */<br />
XrmoptionStickyArg, /* Value is characters immediately following option */<br />
XrmoptionSepArg, /* Value is next argument in argv */<br />
XrmoptionResArg, /* Use the next argument as input to XrmPutLineResource*/<br />
XrmoptionSkipArg, /* Ignore this option and the next argument in argv */<br />
XrmoptionSkipNArgs, /* Ignore this option and the next */<br />
/* OptionDescRec.value arguments in argv */<br />
XrmoptionSkipLine /* Ignore this option and the rest of argv */<br />
} XrmOptionKind;<br />
typedef struct {<br />
char *option; /* Option name in argv */<br />
char *specifier; /* Resource name (without application name) */<br />
XrmOptionKind argKind; /* Location of the resource value */<br />
XPointer value; /* Value to provide if XrmoptionNoArg */<br />
} XrmOptionDescRec, *XrmOptionDescList;<br />
</p></div><p>The standard table contains the following entries:</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Option String</th><th align="left">Resource Name</th><th align="left">Argument Kind</th><th align="left">Resource Value</th></tr></thead><tbody><tr><td align="left">−background</td><td align="left">*background</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−bd</td><td align="left">*borderColor</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−bg</td><td align="left">*background</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−borderwidth</td><td align="left">.borderWidth</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−bordercolor</td><td align="left">*borderColor</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−bw</td><td align="left">.borderWidth</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−display</td><td align="left">.display</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−fg</td><td align="left">*foreground</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−fn</td><td align="left">*font</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−font</td><td align="left">*font</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−foreground</td><td align="left">*foreground</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−geometry</td><td align="left">.geometry</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−iconic</td><td align="left">.iconic</td><td align="left">NoArg</td><td align="left">"true"</td></tr><tr><td align="left">−name</td><td align="left">.name</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−reverse</td><td align="left">.reverseVideo</td><td align="left">NoArg</td><td align="left">"on"</td></tr><tr><td align="left">−rv</td><td align="left">.reverseVideo</td><td align="left">NoArg</td><td align="left">"on"</td></tr><tr><td align="left">+rv</td><td align="left">.reverseVideo</td><td align="left">NoArg</td><td align="left">"off"</td></tr><tr><td align="left">−selectionTimeout</td><td align="left">.selectionTimeout</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−synchronous</td><td align="left">.synchronous</td><td align="left">NoArg</td><td align="left">"on"</td></tr><tr><td align="left">+synchronous</td><td align="left">.synchronous</td><td align="left">NoArg</td><td align="left">"off"</td></tr><tr><td align="left">−title</td><td align="left">.title</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−xnllanguage</td><td align="left">.xnlLanguage</td><td align="left">SepArg</td><td align="left">next argument</td></tr><tr><td align="left">−xrm</td><td align="left">next argument</td><td align="left">ResArg</td><td align="left">next argument</td></tr><tr><td align="left">−xtsessionID</td><td align="left">.sessionID</td><td align="left">SepArg</td><td align="left">next argument</td></tr></tbody></table></div><p>
Note that any unique abbreviation for an option name in the standard table
or in the application table is accepted.
</p><p>
If reverseVideo is
<code class="function">True</code>,
the values of
<code class="function">XtDefaultForeground</code>
and
<code class="function">XtDefaultBackground</code>
are exchanged for all screens on the Display.
</p><p>
The value of the synchronous resource specifies whether or not
Xlib is put into synchronous mode. If a value is found in the resource
database during display initialization,
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
makes a call to
<code class="function">XSynchronize</code>
for all display
connections currently open in the application context. Therefore,
when multiple displays are initialized in the same application
context, the most recent value specified for the synchronous resource
is used for all displays in the application context.
</p><p>
The value of the selectionTimeout resource applies to all displays
opened in the same application context. When multiple displays are
initialized in the same application context, the most recent value
specified is used for all displays in the application context.
</p><p>
The -xrm option provides a method of setting any resource in an application.
The next argument should be a quoted string identical in format to a line in
the user resource file.
For example,
to give a red background to all command buttons in an application named
<code class="function">xmh</code>,
you can start it up as
</p><div class="literallayout"><p><br />
xmh -xrm 'xmh*Command.background: red'<br />
</p></div><p>
When it parses the command line,
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
merges the application option table with the standard option table
before calling the Xlib
<code class="function">XrmParseCommand</code>
function.
An entry in the application table with the same name as an entry
in the standard table overrides the standard table entry.
If an option name is a prefix of another option name,
both names are kept in the merged table.
The Intrinsics reserve all option names
beginning with the characters ``-xt'' for future standard uses.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Creating_Widgets"></a>Creating Widgets</h2></div></div></div><p>
The creation of widget instances is a three-phase process:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
The widgets are allocated and initialized with resources
and are optionally added to the managed subset of their parent.
</p></li><li class="listitem"><p>
All composite widgets are notified of their managed children
in a bottom-up traversal of the widget tree.
</p></li><li class="listitem"><p>
The widgets create X windows, which then are mapped.
</p></li></ol></div><p>
To start the first phase,
the application calls
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
for all its widgets and adds some (usually, most or all) of its widgets
to their respective parents' managed set by calling
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>.
To avoid an O(n<sup>2</sup>) creation process where each composite widget
lays itself out each time a widget is created and managed,
parent widgets are not notified of changes in their managed set
during this phase.
</p><p>
After all widgets have been created,
the application calls
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
with the top-level widget to execute the second and third phases.
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
first recursively traverses the widget tree in a postorder (bottom-up)
traversal and then notifies each composite widget with one
or more managed children by means of its change_managed procedure.
</p><p>
Notifying a parent about its managed set involves geometry layout and
possibly geometry negotiation.
A parent deals with constraints on its size imposed from above
(for example, when a user specifies the application window size)
and suggestions made from below (for example,
when a primitive child computes its preferred size).
One difference between the two can cause geometry changes to ripple
in both directions through the widget tree.
The parent may force some of its children to change size and position
and may issue geometry requests to its own parent in order to better
accommodate all its children.
You cannot predict where anything will go on the screen
until this process finishes.
</p><p>
Consequently, in the first and second phases,
no X windows are actually created, because it is likely
that they will get moved around after creation.
This avoids unnecessary requests to the X server.
</p><p>
Finally,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
starts the third phase by making a preorder (top-down) traversal
of the widget tree, allocates an X window to each widget by means of
its realize procedure, and finally maps the widgets that are managed.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Creating_and_Merging_Argument_Lists"></a>Creating and Merging Argument Lists</h3></div></div></div><p>
Many Intrinsics functions may be passed pairs of resource names and
values.
These are passed as an arglist, a pointer to an array of
<code class="function">Arg</code>
structures, which contains
</p><div class="literallayout"><p><br />
typedef struct {<br />
String name;<br />
XtArgVal value;<br />
} Arg, *ArgList;<br />
</p></div><p>
where
<code class="function">XtArgVal</code>
is as defined in Section 1.5.
</p><p>
If the size of the resource is less than or equal to the size of an
<code class="function">XtArgVal</code>,
the resource value is stored directly in <span class="emphasis"><em>value</em></span>;
otherwise, a pointer to it is stored in <span class="emphasis"><em>value</em></span>.
</p><p>
To set values in an
<code class="function">ArgList</code>,
use
<a class="xref" href="#XtSetArg"><code class="function">XtSetArg</code></a>.
</p><div class="funcsynopsis"><a id="XtSetArg"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetArg</strong>(</code>Arg <var class="pdparam">arg</var>, String <var class="pdparam">name</var>, XtArgVal <var class="pdparam">value</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>arg</em></span>
</span></p></td><td><p>
Specifies the <span class="emphasis"><em>name/value</em></span> pair to set.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the name of the resource.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value</em></span>
</span></p></td><td><p>
Specifies the value of the resource if it will fit in an
<code class="function">XtArgVal</code>,
else the address.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtSetArg"><code class="function">XtSetArg</code></a>
function is usually used in a highly stylized manner to
minimize the probability of making a mistake; for example:
</p><div class="literallayout"><p><br />
Arg args[20];<br />
int n;<br />
n = 0;<br />
XtSetArg(args[n], XtNheight, 100); n++;<br />
XtSetArg(args[n], XtNwidth, 200); n++;<br />
XtSetValues(widget, args, n);<br />
</p></div><p>
Alternatively, an application can statically declare the argument list
and use
<a class="xref" href="#XtNumber"><code class="function">XtNumber</code></a>:
</p><div class="literallayout"><p><br />
static Args args[] = {<br />
{XtNheight, (XtArgVal) 100},<br />
{XtNwidth, (XtArgVal) 200},<br />
};<br />
XtSetValues(Widget, args, XtNumber(args));<br />
</p></div><p>
Note that you should not use expressions with side effects such as
auto-increment or auto-decrement
within the first argument to
<a class="xref" href="#XtSetArg"><code class="function">XtSetArg</code></a>.
<a class="xref" href="#XtSetArg"><code class="function">XtSetArg</code></a>
can be implemented as a macro that evaluates the first argument twice.
</p><p>
To merge two
arglist arrays, use
<a class="xref" href="#XtMergeArgLists"><code class="function">XtMergeArgLists</code></a>.
</p><div class="funcsynopsis"><a id="XtMergeArgLists"></a><p><code class="funcdef">ArgList <strong class="fsfunc">XtMergeArgLists</strong>(</code>ArgList <var class="pdparam">args1</var>, Cardinal <var class="pdparam">num_args1</var>, ArgList <var class="pdparam">args2</var>, Cardinal <var class="pdparam">num_args2</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>args1</em></span>
</span></p></td><td><p>
Specifies the first argument list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args1</em></span>
</span></p></td><td><p>
Specifies the number of entries in the first argument list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args2</em></span>
</span></p></td><td><p>
Specifies the second argument list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args2</em></span>
</span></p></td><td><p>
Specifies the number of entries in the second argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtMergeArgLists"><code class="function">XtMergeArgLists</code></a>
function allocates enough storage to hold the combined
arglist arrays and copies them into it.
Note that it does not check for duplicate entries.
The length of the returned list is the sum of the lengths of the
specified lists.
When it is no longer needed,
free the returned storage by using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>.
</p><p>
All Intrinsics interfaces that require
<code class="function">ArgList</code>
arguments have analogs
conforming to the ANSI C variable argument list
(traditionally called ``varargs'')
calling convention. The name of the analog is formed by prefixing
``Va'' to the name of the corresponding
<code class="function">ArgList</code>
procedure; e.g.,
<a class="xref" href="#XtVaCreateWidget"><code class="function">XtVaCreateWidget</code></a>.
Each procedure named <code class="function">XtVa</code><span class="emphasis"><em>something</em></span> takes as its
last arguments, in place of the corresponding
<code class="function">ArgList</code>/
<code class="function">Cardinal</code>
parameters, a variable parameter list of resource name and
value pairs where each name is of type
<code class="function">String</code>
and each value is of type
<code class="function">XtArgVal</code>.
The end of the list is identified by a <span class="emphasis"><em>name</em></span> entry
containing NULL. Developers writing in the C language wishing to pass
resource name and value pairs to any of these interfaces may use the
<code class="function">ArgList</code>
and varargs forms interchangeably.
</p><p>
Two special names are defined for use only in varargs lists:
<code class="function">XtVaTypedArg</code>
and
<code class="function">XtVaNestedList</code>.
</p><div class="literallayout"><p><br />
#define XtVaTypedArg "XtVaTypedArg"<br />
</p></div><p>
If the name
<code class="function">XtVaTypedArg</code>
is specified in place of a resource
name, then the following four arguments are interpreted as a
<span class="emphasis"><em>name/type/value/size</em></span> tuple <span class="emphasis"><em>where</em></span> name is of type
<code class="function">String</code>,
<span class="emphasis"><em>type</em></span> is of type
<code class="function">String</code>,
<span class="emphasis"><em>value</em></span> is of type
<code class="function">XtArgVal</code>,
and <span class="emphasis"><em>size</em></span> is of type int. When a varargs list containing
<code class="function">XtVaTypedArg</code>
is processed, a resource type
conversion (see <a class="xref" href="#Resource_Conversions" title="Resource Conversions">the section called “Resource Conversions”</a>) is performed if necessary to convert the
value into the format required by the associated resource. If <span class="emphasis"><em>type</em></span> is
XtRString, then <span class="emphasis"><em>value</em></span> contains a pointer to the string and <span class="emphasis"><em>size</em></span>
contains the number of bytes allocated, including the trailing null
byte. If <span class="emphasis"><em>type</em></span> is not XtRString, then <span class="emphasis"><em>if</em></span> size is
less than or equal to
<code class="function">sizeof</code>(<code class="function">XtArgVal</code>), the value should be the data cast to the type
<code class="function">XtArgVal</code>,
otherwise <span class="emphasis"><em>value</em></span> is a pointer to the data. If the type
conversion fails for any reason, a warning message is issued and the
list entry is skipped.
</p><div class="literallayout"><p><br />
#define XtVaNestedList "XtVaNestedList"<br />
</p></div><p>
If the name
<code class="function">XtVaNestedList</code>
is specified in place of a resource name,
then the following argument is interpreted as an
<code class="function">XtVarArgsList</code>
value, which specifies another
varargs list that is logically inserted into the original list at the
point of declaration. The end of the nested list is identified with a
name entry containing NULL. Varargs lists may nest to any depth.
</p><p>
To dynamically allocate a varargs list for use with
<code class="function">XtVaNestedList</code>
in multiple calls, use
<a class="xref" href="#XtVaCreateArgsList"><code class="function">XtVaCreateArgsList</code></a>.
</p><div class="literallayout"><p><br />
typedef XtPointer XtVarArgsList;<br />
</p></div><div class="funcsynopsis"><a id="XtVaCreateArgsList"></a><p><code class="funcdef">XtVarArgsList <strong class="fsfunc">XtVaCreateArgsList</strong>(</code>XtPointer <var class="pdparam">unused</var>, <var class="pdparam">...</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>unused</em></span>
</span></p></td><td><p>
This argument is not currently used and must be specified as NULL.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies a variable parameter list of resource
name and value pairs.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtVaCreateArgsList"><code class="function">XtVaCreateArgsList</code></a>
function allocates memory and copies its arguments into a
single list pointer, which may be used with
<code class="function">XtVaNestedList</code>.
The end of
both lists is identified by a <span class="emphasis"><em>name</em></span> entry containing NULL. Any entries
of type
<code class="function">XtVaTypedArg</code>
are copied as specified without applying
conversions. Data passed by reference (including Strings) are not
copied, only the pointers themselves; the caller must ensure that the
data remain valid for the lifetime of the created varargs list. The
list should be freed using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when no longer needed.
</p><p>
Use of resource files and of the resource database is generally
encouraged over lengthy arglist or varargs lists whenever possible in
order to permit modification without recompilation.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Creating_a_Widget_Instance"></a>Creating a Widget Instance</h3></div></div></div><p>
To create an instance of a widget, use
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtCreateWidget"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtCreateWidget</strong>(</code>String <var class="pdparam">name</var>, WidgetClass <var class="pdparam">object_class</var>, Widget <var class="pdparam">parent</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the resource instance name for the created widget,
which is used for retrieving resources
and, for that reason, should not be the same as any other widget
that is a child of the same parent.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>object_class</em></span>
</span></p></td><td><p>
Specifies the widget class pointer for the created object. Must be <span class="strong"><strong>objectClass</strong></span> or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>parent</em></span>
</span></p></td><td><p>
Specifies the parent widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any other resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
function performs all the boilerplate operations of widget
creation, doing the following in order:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Checks to see if the class_initialize procedure has been called for this class
and for all superclasses and, if not, calls those necessary in a
superclass-to-subclass order.
</p></li><li class="listitem"><p>
If the specified class is not
<code class="function">coreWidgetClass</code>
or a subclass thereof,
and the parent's class is a subclass of
<code class="function">compositeWidgetClass</code>
and either no extension record in
the parent's composite class part extension field exists with the
<span class="emphasis"><em>record_type</em></span>
<span class="strong"><strong>NULLQUARK</strong></span>
or the <span class="emphasis"><em>accepts_objects</em></span> field in the extension
record is
<code class="function">False</code>,
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
issues a fatal error; see <a class="xref" href="#Addition_of_Children_to_a_Composite_Widget_The_insert_child_Procedure" title="Addition of Children to a Composite Widget: The insert_child Procedure">the section called “Addition of Children to a Composite Widget: The insert_child Procedure”</a> and <a class="xref" href="#Nonwidget_Objects" title="Chapter 12. Nonwidget Objects">Chapter 12, <em>Nonwidget Objects</em></a>.
</p></li><li class="listitem"><p>
If the specified class contains an extension record in the object class
part <span class="emphasis"><em>extension</em></span> field with <span class="emphasis"><em>record_type</em></span>
<span class="strong"><strong>NULLQUARK</strong></span>
and the <span class="emphasis"><em>allocate</em></span> field is not NULL,
the procedure is invoked to allocate memory
for the widget instance. If the parent is a member of the class
<code class="function">constraintWidgetClass</code>,
the procedure also allocates memory for the
parent's constraints and stores the address of this memory into the
<span class="emphasis"><em>constraints</em></span> field. If no allocate procedure is found, the Intrinsics
allocate memory for the widget and, when applicable, the constraints,
and initializes the <span class="emphasis"><em>constraints</em></span> field.
</p></li><li class="listitem"><p>
Initializes the Core nonresource data fields
<span class="emphasis"><em>self</em></span>, <span class="emphasis"><em>parent</em></span>, <span class="emphasis"><em>widget_class</em></span>, <span class="emphasis"><em>being_destroyed</em></span>,
<span class="emphasis"><em>name</em></span>, <span class="emphasis"><em>managed</em></span>, <span class="emphasis"><em>window</em></span>, <span class="emphasis"><em>visible</em></span>,
<span class="emphasis"><em>popup_list</em></span>, and <span class="emphasis"><em>num_popups</em></span>.
</p></li><li class="listitem"><p>
Initializes the resource fields (for example, <span class="emphasis"><em>background_pixel</em></span>)
by using the
<code class="function">CoreClassPart</code>
resource lists specified for this class and all superclasses.
</p></li><li class="listitem"><p>
If the parent is a member of the class
<code class="function">constraintWidgetClass</code>,
initializes the resource fields of the constraints record
by using the
<code class="function">ConstraintClassPart</code>
resource lists specified for the parent's class
and all superclasses up to
<code class="function">constraintWidgetClass</code>.
</p></li><li class="listitem"><p>
Calls the initialize procedures for the widget starting at the
Object
initialize procedure on down to the widget's initialize procedure.
</p></li><li class="listitem"><p>
If the parent is a member of the class
<code class="function">constraintWidgetClass</code>,
calls the
<code class="function">ConstraintClassPart</code>
initialize procedures,
starting at
<code class="function">constraintWidgetClass</code>
on down to the parent's
<code class="function">ConstraintClassPart</code>
initialize procedure.
</p></li><li class="listitem"><p>
If the parent is a member of the class
<code class="function">compositeWidgetClass</code>,
puts the widget into its parent's children list by calling its parent's
insert_child procedure.
For further information,
see <a class="xref" href="#Addition_of_Children_to_a_Composite_Widget_The_insert_child_Procedure" title="Addition of Children to a Composite Widget: The insert_child Procedure">the section called “Addition of Children to a Composite Widget: The insert_child Procedure”</a>.
</p></li></ul></div><p>
To create an instance of a widget using varargs lists, use
<a class="xref" href="#XtVaCreateWidget"><code class="function">XtVaCreateWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtVaCreateWidget"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtVaCreateWidget</strong>(</code>String <var class="pdparam">name</var>, WidgetClass <var class="pdparam">object_class</var>, Widget <var class="pdparam">parent</var>, <var class="pdparam">...</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the resource name for the created widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>object_class</em></span>
</span></p></td><td><p>
Specifies the widget class pointer for the created object. Must be <span class="strong"><strong>objectClass</strong></span> or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>parent</em></span>
</span></p></td><td><p>
Specifies the parent widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtVaCreateWidget"><code class="function">XtVaCreateWidget</code></a>
procedure is identical in function to
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list,
as described
in Section 2.5.1.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Creating_an_Application_Shell_Instance"></a>Creating an Application Shell Instance</h3></div></div></div><p>
An application can have multiple top-level widgets, each of which
specifies a unique widget tree
that can potentially be on different screens or displays.
An application uses
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
to create independent widget trees.
</p><div class="funcsynopsis"><a id="XtAppCreateShell"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtAppCreateShell</strong>(</code>String <var class="pdparam">name</var>, String <var class="pdparam">application_class</var>, WidgetClass <var class="pdparam">widget_class</var>, Display * <var class="pdparam">display</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the instance name of the shell widget.
If <span class="emphasis"><em>name</em></span> is NULL,
the application name passed to
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
is used.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the resource class string to be used in
place of the widget <span class="emphasis"><em>class_name</em></span> string when
<span class="emphasis"><em>widget_class</em></span> is
<code class="function">applicationShellWidgetClass</code>
or a subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class for the top-level widget (e.g.,
<code class="function">applicationShellWidgetClass ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display for the default screen
and for the resource database used to retrieve
the shell widget resources.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any other resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
function
creates a new shell widget instance as the root of a widget tree.
The screen resource for this widget is determined by first scanning
<span class="emphasis"><em>args</em></span> for the XtNscreen argument. If no XtNscreen argument is
found, the resource database associated with the default screen of
the specified display is queried for the resource <span class="emphasis"><em>name</em></span>.screen,
class <span class="emphasis"><em>Class</em></span>.Screen where <span class="emphasis"><em>Class</em></span> is the specified
<span class="emphasis"><em>application_class</em></span> if <span class="emphasis"><em>widget_class</em></span> is
<code class="function">applicationShellWidgetClass</code>
or a subclass thereof. If <span class="emphasis"><em>widget_class</em></span> is not
<code class="function">application\%Shell\%Widget\%Class</code>
or a subclass, <span class="emphasis"><em>Class</em></span> is the <span class="emphasis"><em>class_name</em></span>
field from the
<code class="function">CoreClassPart</code>
of the specified <span class="emphasis"><em>widget_class</em></span>.
If this query fails, the default
screen of the specified display is used. Once the screen is determined,
the resource database associated with that screen is used to retrieve
all remaining resources for the shell widget not specified in
<span class="emphasis"><em>args</em></span>. The widget name and <span class="emphasis"><em>Class</em></span> as determined above are
used as the leftmost (i.e., root) components in all fully qualified
resource names for objects within this widget tree.
</p><p>
If the specified widget class is a subclass of WMShell, the name and
<span class="emphasis"><em>Class</em></span> as determined above will be stored into the
<span class="strong"><strong>WM_CLASS</strong></span>
property on the widget's window when it becomes realized.
If the specified <span class="emphasis"><em>widget_class</em></span> is
<code class="function">applicationShellWidgetClass</code>
or a subclass thereof, the
<span class="strong"><strong>WM_COMMAND</strong></span>
property will also be set from the values of the XtNargv and
XtNargc resources.
</p><p>
To create multiple top-level shells within a single (logical)
application,
you can use one of two methods:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Designate one shell as the real top-level shell and
create the others as pop-up children of it by using
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>.
</p></li><li class="listitem"><p>
Have all shells as pop-up children of an unrealized top-level shell.
</p></li></ul></div><p>
The first method,
which is best used when there is a clear choice for what is the main window,
leads to resource specifications like the following:
</p><div class="literallayout"><p><br />
xmail.geometry:... (the main window)<br />
xmail.read.geometry:... (the read window)<br />
xmail.compose.geometry:... (the compose window)<br />
</p></div><p>
The second method,
which is best if there is no main window,
leads to resource specifications like the following:
</p><div class="literallayout"><p><br />
xmail.headers.geometry:... (the headers window)<br />
xmail.read.geometry:... (the read window)<br />
xmail.compose.geometry:... (the compose window)<br />
</p></div><p>
To create a top-level widget that is the root of a widget tree using
varargs lists, use
<a class="xref" href="#XtVaAppCreateShell"><code class="function">XtVaAppCreateShell</code></a>.
</p><div class="funcsynopsis"><a id="XtVaAppCreateShell"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtVaAppCreateShell</strong>(</code>String <var class="pdparam">name</var>, String <var class="pdparam">application_class</var>, WidgetClass <var class="pdparam">widget_class</var>, Display * <var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the instance name of the shell widget.
If <span class="emphasis"><em>name</em></span> is NULL,
the application name passed to
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
is used.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the resource class string to be used in
place of the widget <span class="emphasis"><em>class_name</em></span> string when
<span class="emphasis"><em>widget_class</em></span> is
<code class="function">applicationShellWidgetClass</code>
or a subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class for the top-level widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display for the default screen
and for the resource database used to retrieve
the shell widget resources.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtVaAppCreateShell"><code class="function">XtVaAppCreateShell</code></a>
procedure is identical in function to
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list, as
described in Section 2.5.1.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Convenience_Procedure_to_Initialize_an_Application"></a>Convenience Procedure to Initialize an Application</h3></div></div></div><p>
To initialize the Intrinsics internals, create an application context,
open and initialize a display, and create the initial root shell
instance, an application may use
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>
or
<a class="xref" href="#XtVaOpenApplication"><code class="function">XtVaOpenApplication</code></a>.
</p><div class="funcsynopsis"><a id="XtOpenApplication"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtOpenApplication</strong>(</code>XtAppContext * <var class="pdparam">app_context_return</var>, String <var class="pdparam">application_class</var>, XrmOptionDescList <var class="pdparam">options</var>, Cardinal <var class="pdparam">num_options</var>, int * <var class="pdparam">argc_in_out</var>, String * <var class="pdparam">argv_in_out</var>, String * <var class="pdparam">fallback_resources</var>, WidgetClass <var class="pdparam">widget_class</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context_return</em></span>
</span></p></td><td><p>
Returns the application context, if non-NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the class name of the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>options</em></span>
</span></p></td><td><p>
Specifies the command line options table.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_options</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>options</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argc_in_out</em></span>
</span></p></td><td><p>
Specifies a pointer to the number of command line arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argv_in_out</em></span>
</span></p></td><td><p>
Specifies a pointer to the command line arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>fallback_resources</em></span>
</span></p></td><td><p>
Specifies resource values to be used if the application class resource
file cannot be opened or read, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the class of the widget to be created. Must be shellWidgetClass
or a subclass.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any
other resource specifications for the created shell widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>
function calls
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>
followed by
<a class="xref" href="#XtCreateApplicationContext"><code class="function">XtCreateApplicationContext</code></a>,
then calls
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
with <span class="emphasis"><em>display_string</em></span> NULL and
<span class="emphasis"><em>application_name</em></span> NULL, and finally calls
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
with <span class="emphasis"><em>name</em></span> NULL, the specified <span class="emphasis"><em>widget_class</em></span>,
an argument list and count,
and returns the created shell.
The recommended <span class="emphasis"><em>widget_class</em></span> is
<code class="function">sessionShellWidgetClass</code>.
The argument list and count are created by merging
the specified <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> with a list
containing the specified <span class="emphasis"><em>argc</em></span> and <span class="emphasis"><em>argv</em></span>.
The modified <span class="emphasis"><em>argc</em></span> and <span class="emphasis"><em>argv</em></span> returned by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
are returned in <span class="emphasis"><em>argc_in_out</em></span> and <span class="emphasis"><em>argv_in_out</em></span>. If
<span class="emphasis"><em>app_context_return</em></span> is not NULL, the created application context is
also returned. If the display specified by the command line cannot be
opened, an error message is issued and
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>
terminates the application. If <span class="emphasis"><em>fallback_resources</em></span> is non-NULL,
<a class="xref" href="#XtAppSetFallbackResources"><code class="function">XtAppSetFallbackResources</code></a>
is called with the value prior to calling
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>.
</p><div class="funcsynopsis"><a id="XtVaOpenApplication"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtVaOpenApplication</strong>(</code>XtAppContext * <var class="pdparam">app_context_return</var>, String <var class="pdparam">application_class</var>, XrmOptionDescList <var class="pdparam">options</var>, Cardinal <var class="pdparam">num_options</var>, int * <var class="pdparam">argc_in_out</var>, String * <var class="pdparam">argv_in_out</var>, String * <var class="pdparam">fallback_resources</var>, WidgetClass <var class="pdparam">widget_class</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context_return</em></span>
</span></p></td><td><p>
Returns the application context, if non-NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the class name of the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>options</em></span>
</span></p></td><td><p>
Specifies the command line options table.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_options</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>options</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argc_in_out</em></span>
</span></p></td><td><p>
Specifies a pointer to the number of command line arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argv_in_out</em></span>
</span></p></td><td><p>
Specifies the command line arguments array.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>fallback_resources</em></span>
</span></p></td><td><p>
Specifies resource values to be used if the application class
resource file cannot be opened, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the class of the widget to be created. Must be shellWidgetClass
or a subclass.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications for the created shell.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtVaOpenApplication"><code class="function">XtVaOpenApplication</code></a>
procedure is identical in function to
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list,
as described
in Section 2.5.1.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Instance_Allocation_The_allocate_Procedure"></a>Widget Instance Allocation: The allocate Procedure</h3></div></div></div><p>
A widget class may optionally provide an instance allocation procedure
in the
<code class="function">ObjectClassExtension</code>
record.
</p><p>
When the call to create a widget includes a varargs list containing
<code class="function">XtVaTypedArg</code>,
these arguments will be passed to the allocation procedure in an
<code class="function">XtTypedArgList</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
String name;<br />
String type;<br />
XtArgVal value;<br />
int size;<br />
} XtTypedArg, *XtTypedArgList;<br />
</p></div><p>
The allocate procedure pointer in the
<code class="function">ObjectClassExtension</code>
record is of type
<a class="xref" href="#XtAllocateProc"><code class="function">(*AllocateProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtAllocateProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*AllocateProc)</strong>(</code>WidgetClass <var class="pdparam">widget_class</var>, Cardinal* <var class="pdparam">constraint_size</var>, Cardinal* <var class="pdparam">more_bytes</var>, ArgList <var class="pdparam">args</var>, Cardinal* <var class="pdparam">num_args</var>, XtTypedArgList <var class="pdparam">typed_args</var>, Cardinal* <var class="pdparam">num_typed_args</var>, Widget* <var class="pdparam">new_return</var>, XtPointer* <var class="pdparam">more_bytes_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class of the instance to allocate.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>constraint_size</em></span>
</span></p></td><td><p>
Specifies the size of the constraint record to allocate, or 0.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>more_bytes</em></span>
</span></p></td><td><p>
Specifies the number of auxiliary bytes of memory to allocate.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list as given in the call to create the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>typed_args</em></span>
</span></p></td><td><p>
Specifies the list of typed arguments given in the call to create the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_typed_args</em></span>
</span></p></td><td><p>
Specifies the number of typed arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>new_return</em></span>
</span></p></td><td><p>
Returns a pointer to the newly allocated instance, or NULL in case of error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>more_bytes_return</em></span>
</span></p></td><td><p>
Returns the auxiliary memory if it was requested, or NULL
if requested and an error occurred; otherwise, unchanged.
</p></td></tr></tbody></table></div><p>
At widget allocation time, if an extension record with <span class="emphasis"><em>record_type</em></span>
equal to
<span class="strong"><strong>NULLQUARK</strong></span>
is located through the object class part <span class="emphasis"><em>extension</em></span> field
and the <span class="emphasis"><em>allocate</em></span> field is not NULL, the
<a class="xref" href="#XtAllocateProc"><code class="function">(*AllocateProc)</code></a>
will be invoked to allocate memory for the widget. If no ObjectClassPart
extension record is declared with <span class="emphasis"><em>record_type equal</em></span> to
<span class="strong"><strong>NULLQUARK</strong></span>,
then
<code class="function">XtInheritAllocate</code>
and
<code class="function">XtInheritDeallocate</code>
are assumed.
If no
<a class="xref" href="#XtAllocateProc"><code class="function">(*AllocateProc)</code></a>
is found, the Intrinsics will allocate memory for the widget.
</p><p>
An
<a class="xref" href="#XtAllocateProc"><code class="function">(*AllocateProc)</code></a>
must perform the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Allocate memory for the widget instance and return it in <span class="emphasis"><em>new_return</em></span>.
The memory must be at least <span class="emphasis"><em>wc->core_class.widget_size</em></span> bytes in length,
double-word aligned.
</p></li><li class="listitem"><p>
Initialize the <span class="emphasis"><em>core.constraints</em></span> field in the instance record to NULL
or to point to a constraint record. If <span class="emphasis"><em>constraint_size</em></span>
is not 0, the procedure must allocate memory for the constraint record.
The memory must be double-word aligned.
</p></li><li class="listitem"><p>
If <span class="emphasis"><em>more_bytes</em></span> is not 0, then the address of a block of memory
at least <span class="emphasis"><em>more_bytes</em></span> in size, double-word aligned, must be
returned in the <span class="emphasis"><em>more_bytes_return</em></span> parameter,
or NULL to indicate an error.
</p></li></ul></div><p>
A class allocation procedure that envelops the allocation procedure of a
superclass must rely on the enveloped procedure to perform the instance
and constraint allocation.
Allocation procedures should refrain from initializing fields in the
widget record except to store pointers to newly allocated additional memory.
Under no circumstances should an allocation procedure that envelopes
its superclass allocation procedure modify fields in the
instance part of any superclass.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Instance_Initialization_The_initialize_Procedure"></a>Widget Instance Initialization: The initialize Procedure</h3></div></div></div><p>
The initialize procedure pointer in a widget class is of type
<a class="xref" href="#XtInitProc"><code class="function">(*XtInitProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtInitProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtInitProc)</strong>(</code>Widget <var class="pdparam">request</var>, Widget <var class="pdparam">new</var>, ArgList <var class="pdparam">args</var>, Cardinal * <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>request</em></span>
</span></p></td><td><p>
Specifies a copy of the widget with resource values as requested by the
argument list, the resource database, and the widget defaults.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>new</em></span>
</span></p></td><td><p>
Specifies the widget with the new values, both resource and nonresource,
that are actually allowed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list passed by the client, for
computing derived resource values.
If the client created the widget using a varargs form, any resources
specified via
<code class="function">XtVaTypedArg</code>
are converted to the widget representation and the list is transformed
into the
<code class="function">ArgList</code>
format.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
An initialization procedure performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Allocates space for and copies any resources referenced by address
that the client is allowed to free or modify
after the widget has been created.
For example,
if a widget has a field that is a
<code class="function">String</code>,
it may choose not to
depend on the characters at that address remaining constant
but dynamically allocate space for the string and copy it to the new space.
Widgets that do not copy one or more resources referenced
by address should clearly so state in their user documentation.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
It is not necessary to allocate space for or to copy callback lists.
</p></div><p>
</p></li><li class="listitem"><p>
Computes values for unspecified resource fields.
For example, if <span class="emphasis"><em>width</em></span> and <span class="emphasis"><em>height</em></span> are zero,
the widget should compute an appropriate width and height
based on its other resources.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
A widget may directly assign only
its own <span class="emphasis"><em>width</em></span> and <span class="emphasis"><em>height</em></span> within the initialize, initialize_hook,
set_values, and
set_values_hook procedures; see <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6, <em>Geometry Management</em></a>.
</p></div><p>
</p></li><li class="listitem"><p>
Computes values for uninitialized nonresource fields that are derived from
resource fields.
For example, graphics contexts (GCs) that the widget uses are derived from
resources like background, foreground, and font.
</p></li></ul></div><p>
An initialization procedure also can check certain fields for
internal consistency.
For example, it makes no sense to specify a colormap for a depth
that does not support that colormap.
</p><p>
Initialization procedures are called in superclass-to-subclass order
after all fields specified in the resource lists have been
initialized. The initialize procedure does not need to examine
<span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span>
if all public resources are declared in the resource list.
Most of the initialization code for a specific widget class deals with fields
defined in that class and not with fields defined in its superclasses.
</p><p>
If a subclass does not need an initialization procedure
because it does not need to perform any of the above operations,
it can specify NULL for the <span class="emphasis"><em>initialize</em></span> field in the class record.
</p><p>
Sometimes a subclass may want to overwrite values filled in by its
superclass.
In particular, size calculations of a superclass often are
incorrect for a subclass, and in this case,
the subclass must modify or recalculate fields declared
and computed by its superclass.
</p><p>
As an example,
a subclass can visually surround its superclass display.
In this case, the width and height calculated by the superclass initialize
procedure are too small and need to be incremented by the size of the surround.
The subclass needs to know if its superclass's size was calculated by the
superclass or was specified explicitly.
All widgets must place themselves into whatever size is explicitly given,
but they should compute a reasonable size if no size is requested.
</p><p>
The <span class="emphasis"><em>request</em></span> and <span class="emphasis"><em>new</em></span> arguments provide the necessary information for
a subclass to determine the difference between an explicitly specified field
and a field computed by a superclass.
The <span class="emphasis"><em>request</em></span> widget is a copy of the widget as initialized by the
arglist and resource database.
The <span class="emphasis"><em>new</em></span> widget starts with the values in the request,
but it has been updated by all superclass initialization procedures called
so far.
A subclass initialize procedure can compare these two to resolve
any potential conflicts.
</p><p>
In the above example,
the subclass with the visual surround can see
if the <span class="emphasis"><em>width</em></span> and <span class="emphasis"><em>height</em></span> in the <span class="emphasis"><em>request</em></span> widget are zero.
If so,
it adds its surround size to the <span class="emphasis"><em>width</em></span> and <span class="emphasis"><em>height</em></span>
fields in the <span class="emphasis"><em>new</em></span> widget.
If not, it must make do with the size originally specified.
</p><p>
The <span class="emphasis"><em>new</em></span> widget will become the actual widget instance record.
Therefore,
the initialization procedure should do all its work on the <span class="emphasis"><em>new</em></span> widget;
the <span class="emphasis"><em>request</em></span> widget should never be modified.
If the initialize procedure
needs to call any routines that operate on a widget,
it should specify <span class="emphasis"><em>new</em></span> as the widget instance.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Constraint_Instance_Initialization_The_ConstraintClassPart_initialize_Procedure"></a>Constraint Instance Initialization: The ConstraintClassPart initialize Procedure</h3></div></div></div><p>
The constraint initialization procedure pointer, found in the
<code class="function">ConstraintClassPart</code>
<span class="emphasis"><em>initialize</em></span> field of the widget class record, is of type
<a class="xref" href="#XtInitProc"><code class="function">(*XtInitProc)</code></a>.
The values passed to the parent constraint initialization procedures
are the same as those passed to the child's class widget initialization
procedures.
</p><p>
The <span class="emphasis"><em>constraints</em></span> field of the <span class="emphasis"><em>request</em></span> widget points to a copy of the
constraints record as initialized by the arglist and resource database.
</p><p>
The constraint initialization procedure should compute any constraint fields
derived from constraint resources.
It can make further changes to the <span class="emphasis"><em>new</em></span> widget to make the widget
and any other constraint fields
conform to the specified constraints, for example,
changing the widget's size or position.
</p><p>
If a constraint class does not need a constraint initialization procedure,
it can specify NULL for the <span class="emphasis"><em>initialize</em></span> field of the
<code class="function">ConstraintClassPart</code>
in the class record.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Nonwidget_Data_Initialization_The_initialize_hook_Procedure"></a>Nonwidget Data Initialization: The initialize_hook Procedure</h3></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
The initialize_hook procedure is obsolete, as the same information
is now available to the initialize procedure. The procedure has been
retained for those widgets that used it in previous releases.
</p></div><p>
The initialize_hook procedure pointer is of type
<a class="xref" href="#XtArgsProc"><code class="function">(*XtArgsProc)</code></a>:
</p><div class="funcsynopsis"><a id="XtArgsProc"></a><p><code class="funcdef">typedef void<strong class="fsfunc">(*XtArgsProc)</strong>(</code>Widget <var class="pdparam">w</var>, ArgList <var class="pdparam">args</var>, Cardinal * <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list passed by the client.
If the client created the widget using a varargs form, any resources
specified via
<code class="function">XtVaTypedArg</code>
are converted to the widget representation and the list is transformed
into the
<code class="function">ArgList</code>
format.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
If this procedure is not NULL,
it is called immediately after the corresponding initialize
procedure or in its place if the <span class="emphasis"><em>initialize</em></span> field is NULL.
</p><p>
The initialize_hook procedure allows a widget instance to initialize
nonresource data using information from the specified argument list
as if it were a resource.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Realizing_Widgets"></a>Realizing Widgets</h2></div></div></div><p>
To realize a widget instance, use
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtRealizeWidget"></a><p><code class="funcdef">void <strong class="fsfunc">XtRealizeWidget</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
If the widget is already realized,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
simply returns.
Otherwise it performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Binds all action names in the widget's
translation table to procedures (see <a class="xref" href="#Action_Names_to_Procedure_Translations" title="Action Names to Procedure Translations">the section called “Action Names to Procedure Translations”</a>).
</p></li><li class="listitem"><p>
Makes a postorder traversal of the widget tree rooted
at the specified widget and calls each non-NULL change_managed procedure
of all composite widgets that have one or more managed children.
</p></li><li class="listitem"><p>
Constructs an
<code class="function">XSetWindowAttributes</code>
structure filled in with information derived from the
Core
widget fields and calls the realize procedure for the widget,
which adds any widget-specific attributes and creates the X window.
</p></li><li class="listitem"><p>
If the widget is
not a subclass of
<code class="function">compositeWidgetClass</code>,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
returns; otherwise it continues and performs the following:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
Descends recursively to each of the widget's
managed children and calls the realize procedures.
Primitive widgets that instantiate children are responsible for realizing
those children themselves.
</p></li><li class="listitem"><p>
Maps all of the managed children windows that have <span class="emphasis"><em>mapped_when_managed</em></span>
<code class="function">True</code>.
If a widget is managed but <span class="emphasis"><em>mapped_when_managed</em></span> is
<code class="function">False</code>,
the widget is allocated visual space but is not displayed.
</p></li></ul></div></li></ul></div><p>
If the widget is a top-level shell widget (that is, it has no parent), and
<span class="emphasis"><em>mapped_when_managed</em></span> is
<code class="function">True</code>,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
maps the widget window.
</p><p>
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>,
<a class="xref" href="#XtVaCreateWidget"><code class="function">XtVaCreateWidget</code></a>,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>,
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>,
<code class="function">XtUnmanage\%Children</code>,
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>,
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>,
and
<code class="function">XtDestroy\%Widget</code>
maintain the following invariants:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
If a composite widget is realized, then all its managed children are realized.
</p></li><li class="listitem"><p>
If a composite widget is realized, then all its managed children that have
<span class="emphasis"><em>mapped_when_managed</em></span>
<code class="function">True</code>
are mapped.
</p></li></ul></div><p>
All Intrinsics functions and all widget routines should accept
either realized or unrealized widgets.
When calling the realize or change_managed
procedures for children of a composite
widget,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
calls the procedures in reverse order of
appearance in the
<code class="function">CompositePart</code>
<span class="emphasis"><em>children</em></span> list. By default, this
ordering of the realize procedures will
result in the stacking order of any newly created subwindows being
top-to-bottom in the order of appearance on the list, and the most
recently created child will be at the bottom.
</p><p>
To check whether or not a widget has been realized, use
<a class="xref" href="#XtIsRealized"><code class="function">XtIsRealized</code></a>.
</p><div class="funcsynopsis"><a id="XtIsRealized"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtIsRealized</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtIsRealized"><code class="function">XtIsRealized</code></a>
function returns
<code class="function">True</code>
if the widget has been realized,
that is, if the widget has a nonzero window ID.
If the specified object is not a widget, the state of the nearest
widget ancestor is returned.
</p><p>
Some widget procedures (for example, set_values) might wish to
operate differently
after the widget has been realized.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Instance_Window_Creation_The_realize_Procedure"></a>Widget Instance Window Creation: The realize Procedure</h3></div></div></div><p>
The realize procedure pointer in a widget class is of type
<a class="xref" href="#XtRealizeProc"><code class="function">(*XtRealizeProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtRealizeProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtRealizeProc)</strong>(</code>Widget <var class="pdparam">w</var>, XtValueMask <var class="pdparam">value_mask</var>, XSetWindowAttributes <var class="pdparam">attributes</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value_mask</em></span>
</span></p></td><td><p>
Specifies which fields in the <span class="emphasis"><em>attributes</em></span> structure are used.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>attributes</em></span>
</span></p></td><td><p>
Specifies the window attributes to use in the
<code class="function">XCreateWindow</code>
call.
</p></td></tr></tbody></table></div><p>
The realize procedure must create the widget's window.
</p><p>
Before calling the class realize procedure, the generic
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
function fills in a mask and a corresponding
<code class="function">XSetWindowAttributes</code>
structure.
It sets the following fields in <span class="emphasis"><em>attributes</em></span> and
corresponding bits in <span class="emphasis"><em>value_mask</em></span>
based on information in the widget
core
structure:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
The <span class="emphasis"><em>background_pixmap</em></span> (or <span class="emphasis"><em>background_pixel</em></span> if <span class="emphasis"><em>background_pixmap</em></span> is
<code class="function">XtUnspecifiedPixmap</code>)
is filled in from the corresponding field.
</p></li><li class="listitem"><p>
The <span class="emphasis"><em>border_pixmap</em></span> (or <span class="emphasis"><em>border_pixel</em></span> if <span class="emphasis"><em>border_pixmap</em></span> is
<code class="function">XtUnspecifiedPixmap</code>)
is filled in from the corresponding field.
</p></li><li class="listitem"><p>
The <span class="emphasis"><em>colormap</em></span> is filled in from the corresponding field.
</p></li><li class="listitem"><p>
The <span class="emphasis"><em>event_mask</em></span> is filled in based on the event handlers registered,
the event translations specified, whether the <span class="emphasis"><em>expose</em></span> field is non-NULL,
and whether <span class="emphasis"><em>visible_interest</em></span> is
<code class="function">True</code>.
</p></li><li class="listitem"><p>
The <span class="emphasis"><em>bit_gravity</em></span> is set to
<code class="function">NorthWestGravity</code>
if the <span class="emphasis"><em>expose</em></span> field is NULL.
</p></li></ul></div><p>
These or any other fields in attributes and the corresponding bits in
<span class="emphasis"><em>value_mask</em></span> can be set by the realize procedure.
</p><p>
Note that because realize is not a chained operation,
the widget class realize procedure must update the
<code class="function">XSetWindowAttributes</code>
structure with all the appropriate fields from
non-Core
superclasses.
</p><p>
A widget class can inherit its realize procedure from its superclass
during class initialization.
The realize procedure defined for
<code class="function">coreWidgetClass</code>
calls
<a class="xref" href="#XtCreateWindow"><code class="function">XtCreateWindow</code></a>
with the passed <span class="emphasis"><em>value_mask</em></span> and <span class="emphasis"><em>attributes</em></span>
and with <span class="emphasis"><em>window_class</em></span> and <span class="emphasis"><em>visual</em></span> set to
<code class="function">CopyFromParent</code>.
Both
<code class="function">compositeWidgetClass</code>
and
<code class="function">constraintWidgetClass</code>
inherit this realize procedure, and most new widget subclasses
can do the same (see <a class="xref" href="#Inheritance_of_Superclass_Operations" title="Inheritance of Superclass Operations">the section called “Inheritance of Superclass Operations”</a>).
</p><p>
The most common noninherited realize procedures set <span class="emphasis"><em>bit_gravity</em></span> in the mask
and attributes to the appropriate value and then create the window.
For example, depending on its justification, Label might set <span class="emphasis"><em>bit_gravity</em></span> to
<code class="function">WestGravity</code>,
<code class="function">CenterGravity</code>,
or
<code class="function">EastGravity</code>.
Consequently, shrinking it would just move the bits appropriately,
and no
exposure
event is needed for repainting.
</p><p>
If a composite widget's children should be realized in an order other
than that specified
(to control the stacking order, for example),
it should call
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
on its children itself in the appropriate order from within its own
realize procedure.
</p><p>
Widgets that have children and whose class is not a subclass of
<code class="function">compositeWidgetClass</code>
are responsible for calling
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
on their children, usually from within the realize procedure.
</p><p>
Realize procedures cannot manage or unmanage their descendants.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Window_Creation_Convenience_Routine"></a>Window Creation Convenience Routine</h3></div></div></div><p>
Rather than call the Xlib
<code class="function">XCreateWindow</code>
function explicitly, a realize procedure should normally call the Intrinsics analog
<a class="xref" href="#XtCreateWindow"><code class="function">XtCreateWindow</code></a>,
which simplifies the creation of windows for widgets.
</p><div class="funcsynopsis"><a id="XtCreateWindow"></a><p><code class="funcdef">void <strong class="fsfunc">XtCreateWindow</strong>(</code>Widget <var class="pdparam">w</var>, unsigned int <var class="pdparam">window_class</var>, Visual * <var class="pdparam">visual</var>, XtValueMask <var class="pdparam">value_mask</var>, XSetWindowAttributes <var class="pdparam">attributes</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that defines the additional window attributed. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>window_class</em></span>
</span></p></td><td><p>
Specifies the Xlib window class (for example,
<code class="function">InputOutput</code>,
<code class="function">InputOnly</code>,
or
<code class="function">CopyFromParent ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>visual</em></span>
</span></p></td><td><p>
Specifies the visual type (usually
<code class="function">CopyFromParent ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value_mask</em></span>
</span></p></td><td><p>
Specifies which fields in the <span class="emphasis"><em>attributes</em></span> structure are used.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>attributes</em></span>
</span></p></td><td><p>
Specifies the window attributes to use in the
<code class="function">XCreateWindow</code>
call.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCreateWindow"><code class="function">XtCreateWindow</code></a>
function calls the Xlib
<code class="function">XCreateWindow</code>
function with values from the widget structure and the passed parameters.
Then, it assigns the created window to the widget's <span class="emphasis"><em>window</em></span> field.
</p><p>
<a class="xref" href="#XtCreateWindow"><code class="function">XtCreateWindow</code></a>
evaluates the following fields of the widget core
structure: <span class="emphasis"><em>depth</em></span>, <span class="emphasis"><em>screen</em></span>, <span class="emphasis"><em>parent->core.window</em></span>, <span class="emphasis"><em>x</em></span>,
<span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>, and
<span class="emphasis"><em>border_width</em></span>.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Obtaining_Window_Information_from_a_Widget"></a>Obtaining Window Information from a Widget</h2></div></div></div><p>
The
Core
widget class definition contains the screen and window ids.
The <span class="emphasis"><em>window</em></span> field may be NULL for a while
(see <a class="xref" href="#Creating_Widgets" title="Creating Widgets">the section called “Creating Widgets”</a> and <a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">the section called “Realizing Widgets”</a>).
</p><p>
The display pointer, the parent widget, screen pointer,
and window of a widget are available to the widget writer by means of macros
and to the application writer by means of functions.
</p><div class="funcsynopsis"><p><code class="funcdef">Display <strong class="fsfunc">XtDisplay</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<code class="function">XtDisplay</code>
returns the display pointer for the specified widget.
</p><div class="funcsynopsis"><p><code class="funcdef">Widget <strong class="fsfunc">XtParent</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<code class="function">XtParent</code>
returns the parent object for the specified widget. The returned object
will be of class Object or a subclass.
</p><div class="funcsynopsis"><a id="XtScreen"></a><p><code class="funcdef">Screen <strong class="fsfunc">*XtScreen</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtScreen"><code class="function">*XtScreen</code></a>
returns the screen pointer for the specified widget.
</p><div class="funcsynopsis"><a id="XtWindow"></a><p><code class="funcdef">Window <strong class="fsfunc">XtWindow</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtWindow"><code class="function">XtWindow</code></a>
returns the window of the specified widget.
</p><p>
The display pointer, screen pointer, and window of a widget or
of the closest widget ancestor of a nonwidget object are available
by means of
<a class="xref" href="#XtDisplayOfObject"><code class="function">*XtDisplayOfObject</code></a>,
<a class="xref" href="#XtScreenOfObject"><code class="function">*XtScreenOfObject</code></a>,
and
<a class="xref" href="#XtWindowOfObject"><code class="function">XtWindowOfObject</code></a>.
</p><div class="funcsynopsis"><a id="XtDisplayOfObject"></a><p><code class="funcdef">Display <strong class="fsfunc">*XtDisplayOfObject</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtDisplayOfObject"><code class="function">*XtDisplayOfObject</code></a>
is identical in function to
<code class="function">XtDisplay</code>
if the object is a widget; otherwise
<a class="xref" href="#XtDisplayOfObject"><code class="function">*XtDisplayOfObject</code></a>
returns the display
pointer for the nearest ancestor of <span class="emphasis"><em>object</em></span> that is of class
Widget or a subclass thereof.
</p><div class="funcsynopsis"><a id="XtScreenOfObject"></a><p><code class="funcdef">Screen <strong class="fsfunc">*XtScreenOfObject</strong>(</code>Widget <var class="pdparam">object</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtScreenOfObject"><code class="function">*XtScreenOfObject</code></a>
is identical in function to
<a class="xref" href="#XtScreen"><code class="function">*XtScreen</code></a>
if the object is a widget; otherwise
<a class="xref" href="#XtScreenOfObject"><code class="function">*XtScreenOfObject</code></a>
returns the screen pointer
for the nearest ancestor of <span class="emphasis"><em>object</em></span> that is of class
Widget or a subclass thereof.
</p><div class="funcsynopsis"><a id="XtWindowOfObject"></a><p><code class="funcdef">Window <strong class="fsfunc">XtWindowOfObject</strong>(</code>Widget <var class="pdparam">object</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtWindowOfObject"><code class="function">XtWindowOfObject</code></a>
is identical in function to
<a class="xref" href="#XtWindow"><code class="function">XtWindow</code></a>
if the object is a widget; otherwise
<a class="xref" href="#XtWindowOfObject"><code class="function">XtWindowOfObject</code></a>
returns the window for the nearest ancestor of <span class="emphasis"><em>object</em></span> that is of class
Widget or a subclass thereof.
</p><p>
To retrieve the instance name of an object, use
<a class="xref" href="#XtName"><code class="function">XtName</code></a>.
</p><div class="funcsynopsis"><a id="XtName"></a><p><code class="funcdef">String <strong class="fsfunc">XtName</strong>(</code>Widget <var class="pdparam">object</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object whose name is desired. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtName"><code class="function">XtName</code></a>
returns a pointer to the instance name of the specified object.
The storage is owned by the Intrinsics and must not be modified. The
name is not qualified by the names of any of the object's ancestors.
</p><p>
Several window attributes are locally cached in the widget instance.
Thus, they can be set by the resource manager and
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
as well as used by routines that derive structures from these values
(for example, <span class="emphasis"><em>depth</em></span> for deriving pixmaps,
<span class="emphasis"><em>background_pixel</em></span> for deriving GCs, and so on) or in the
<a class="xref" href="#XtCreateWindow"><code class="function">XtCreateWindow</code></a>
call.
</p><p>
The <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>, and <span class="emphasis"><em>border_width</em></span>
window attributes are available to
geometry managers.
These fields are maintained synchronously inside the Intrinsics.
When an
<code class="function">XConfigureWindow</code>
is issued by the Intrinsics on the widget's window (on request of its parent),
these values are updated immediately rather than some time later
when the server generates a
<code class="function">ConfigureNotify</code>
event.
(In fact, most widgets do not select
<code class="function">SubstructureNotify</code>
events.)
This ensures that all geometry calculations are based on the internally
consistent toolkit world rather than on either
an inconsistent world updated by asynchronous
<code class="function">ConfigureNotify</code>
events or a consistent, but slow, world in which geometry managers
ask the server
for window sizes whenever they need to lay out their managed children
(see <a class="xref" href="#Geometry_Management" title="Chapter 6. Geometry Management">Chapter 6, <em>Geometry Management</em></a>).
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Unrealizing_Widgets"></a>Unrealizing Widgets</h3></div></div></div><p>
To destroy the windows associated with a widget and its
non-pop-up descendants, use
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtUnrealizeWidget"></a><p><code class="funcdef">void <strong class="fsfunc">XtUnrealizeWidget</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
If the widget is currently unrealized,
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>
simply returns. Otherwise it performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Unmanages the widget if the widget is managed.
</p></li><li class="listitem"><p>
Makes a postorder (child-to-parent) traversal of the widget tree
rooted at the specified widget and, for each widget that has
declared a callback list resource named ``unrealizeCallback'', executes the
procedures on the
XtNunrealizeCallback
list.
</p></li><li class="listitem"><p>
Destroys the widget's window and any subwindows by calling
<code class="function">XDestroyWindow</code>
with the specified widget's <span class="emphasis"><em>window</em></span> field.
</p></li></ul></div><p>
Any events in the queue or which arrive following a call to
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>
will be dispatched as if the window(s) of the
unrealized widget(s) had never existed.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Destroying_Widgets"></a>Destroying Widgets</h2></div></div></div><p>
The Intrinsics provide support
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
To destroy all the pop-up children of the widget being destroyed
and destroy all children of composite widgets.
</p></li><li class="listitem"><p>
To remove (and unmap) the widget from its parent.
</p></li><li class="listitem"><p>
To call the callback procedures that have been registered to trigger
when the widget is destroyed.
</p></li><li class="listitem"><p>
To minimize the number of things a widget has to deallocate when destroyed.
</p></li><li class="listitem"><p>
To minimize the number of
<code class="function">XDestroyWindow</code>
calls when destroying a widget tree.
</p></li></ul></div><p>
To destroy a widget instance, use
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtDestroyWidget"></a><p><code class="funcdef">void <strong class="fsfunc">XtDestroyWidget</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
function provides the only method of destroying a widget,
including widgets that need to destroy themselves.
It can be called at any time,
including from an application callback routine of the widget being destroyed.
This requires a two-phase destroy process in order to avoid dangling
references to destroyed widgets.
</p><p>
In phase 1,
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
If the <span class="emphasis"><em>being_destroyed</em></span> field of the widget is
<code class="function">True</code>,
it returns immediately.
</p></li><li class="listitem"><p>
Recursively descends the widget tree and
sets the <span class="emphasis"><em>being_destroyed</em></span> field to
<code class="function">True</code>
for the widget and all normal and pop-up children.
</p></li><li class="listitem"><p>
Adds the widget to a list of widgets (the destroy list) that should be
destroyed when it is safe to do so.
</p></li></ul></div><p>
Entries on the destroy list satisfy the invariant that
if w2 occurs after w1 on the destroy list, then w2 is not a descendent,
either normal or pop-up, of w1.
</p><p>
Phase 2 occurs when all procedures that should execute as a result of
the current event have been called, including all procedures registered with
the event and translation managers,
that is, when the current invocation of
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
is about to return, or immediately if not in
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>.
</p><p>
In phase 2,
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
performs the following on each entry in the destroy list in the order
specified:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
If the widget is not a pop-up child and the widget's parent is a subclass of
<code class="function">composite\%WidgetClass</code>,
and if the parent is not being destroyed,
it calls
<a class="xref" href="#XtUnmanageChild"><code class="function">XtUnmanageChild</code></a>
on the widget and then calls the widget's parent's delete_child procedure
(see <a class="xref" href="#Deletion_of_Children_The_delete_child_Procedure" title="Deletion of Children: The delete_child Procedure">the section called “Deletion of Children: The delete_child Procedure”</a>).
</p></li><li class="listitem"><p>
Calls the destroy callback procedures registered on the widget
and all normal and pop-up descendants in postorder (it calls child
callbacks before parent callbacks).
</p></li></ul></div><p>
The
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
function then makes second traversal of the widget and all normal
and pop-up descendants to perform the following three items on each
widget in postorder:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
If the widget is not a pop-up child and the widget's parent is a subclass of
<code class="function">constraint\%WidgetClass</code>,
it calls the
<code class="function">ConstraintClassPart</code>
destroy procedure for the parent,
then for the parent's superclass,
until finally it calls the
<code class="function">ConstraintClassPart</code>
destroy procedure for
<code class="function">constraintWidgetClass</code>.
</p></li><li class="listitem"><p>
Calls the
<code class="function">CoreClassPart</code>
destroy procedure declared in the widget class,
then the destroy procedure declared in its superclass,
until finally it calls the destroy procedure declared in the Object
class record. Callback lists are deallocated.
</p></li><li class="listitem"><p>
If the widget class object class part contains an
<code class="function">ObjectClassExtension</code>
record with the record_type
<span class="strong"><strong>NULLQUARK</strong></span>
and the <span class="emphasis"><em>deallocate</em></span> field is not NULL,
calls the deallocate procedure to deallocate the instance and if one
exists, the constraint record. Otherwise, the Intrinsics will deallocate
the widget instance record and if one exists, the constraint record.
</p></li><li class="listitem"><p>
Calls
<code class="function">XDestroyWindow</code>
if the specified widget is realized (that is, has an X window).
The server recursively destroys all normal descendant windows.
(Windows of realized pop-up Shell children, and their
descendants, are destroyed by a shell class destroy procedure.)
</p></li></ul></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Adding_and_Removing_Destroy_Callbacks"></a>Adding and Removing Destroy Callbacks</h3></div></div></div><p>
When an application needs to perform additional processing during the
destruction of a widget,
it should register a destroy callback procedure for the widget.
The destroy callback procedures use the mechanism described in
<a class="xref" href="#Callbacks" title="Chapter 8. Callbacks">Chapter 8, <em>Callbacks</em></a>.
The destroy callback list is identified by the resource name
XtNdestroyCallback.
</p><p>
For example, the following adds an application-supplied destroy callback
procedure <span class="emphasis"><em>ClientDestroy</em></span> with client data to a widget by calling
<a class="xref" href="#XtAddCallback"><code class="function">XtAddCallback</code></a>.
</p><div class="literallayout"><p><br />
XtAddCallback(<span class="emphasis"><em>w</em></span>, XtNdestroyCallback, <span class="emphasis"><em>ClientDestroy</em></span>, <span class="emphasis"><em>client_data</em></span>)<br />
</p></div><p>
Similarly, the following removes the application-supplied destroy callback
procedure <span class="emphasis"><em>ClientDestroy</em></span> by calling
<a class="xref" href="#XtRemoveCallback"><code class="function">XtRemoveCallback</code></a>.
</p><div class="literallayout"><p><br />
XtRemoveCallback(<span class="emphasis"><em>w</em></span>, XtNdestroyCallback, <span class="emphasis"><em>ClientDestroy</em></span>, <span class="emphasis"><em>client_data</em></span>)<br />
</p></div><p>
The <span class="emphasis"><em>ClientDestroy</em></span> argument is of type
<a class="xref" href="#XtCallbackProc"><code class="function">(*XtCallbackProc)</code></a>;
see <a class="xref" href="#Using_Callback_Procedure_and_Callback_List_Definitions" title="Using Callback Procedure and Callback List Definitions">the section called “Using Callback Procedure and Callback List Definitions”</a>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Dynamic_Data_Deallocation_The_destroy_Procedure"></a>Dynamic Data Deallocation: The destroy Procedure</h3></div></div></div><p>
The destroy procedure pointers in the
<code class="function">ObjectClassPart</code>,
<code class="function">RectObjClassPart</code>,
and
<code class="function">CoreClassPart</code>
structures are of type
<a class="xref" href="#XtWidgetProc"><code class="function">XtWidgetProc</code></a>.
</p><div class="funcsynopsis"><a id="XtWidgetProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">XtWidgetProc</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget being destroyed.
</p></td></tr></tbody></table></div><p>
The destroy procedures are called in subclass-to-superclass order.
Therefore, a widget's destroy procedure should deallocate only storage
that is specific to the subclass and should ignore the storage
allocated by any of its superclasses.
The destroy procedure should deallocate only resources that have been
explicitly created by the subclass.
Any resource that was obtained from the resource database
or passed in an argument list was not created by the widget
and therefore should not be destroyed by it.
If a widget does not need to deallocate any storage,
the destroy procedure entry in its class record can be NULL.
</p><p>
Deallocating storage includes, but is not limited to,
the following steps:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Calling
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
on dynamic storage allocated with
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>,
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>,
and so on.
</p></li><li class="listitem"><p>
Calling
<code class="function">XFreePixmap</code>
on pixmaps created with direct X calls.
</p></li><li class="listitem"><p>
Calling
<a class="xref" href="#XtReleaseGC"><code class="function">XtReleaseGC</code></a>
on GCs allocated with
<a class="xref" href="#XtGetGC"><code class="function">XtGetGC</code></a>.
</p></li><li class="listitem"><p>
Calling
<code class="function">XFreeGC</code>
on GCs allocated with direct X calls.
</p></li><li class="listitem"><p>
Calling
<a class="xref" href="#XtRemoveEventHandler"><code class="function">XtRemoveEventHandler</code></a>
on event handlers added to other widgets.
</p></li><li class="listitem"><p>
Calling
<a class="xref" href="#XtRemoveTimeOut"><code class="function">XtRemoveTimeOut</code></a>
on timers created with
<a class="xref" href="#XtAppAddTimeOut"><code class="function">XtAppAddTimeOut</code></a>.
</p></li><li class="listitem"><p>
Calling
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
for each child if the widget has children
and is not a subclass of
<code class="function">compositeWidgetClass</code>.
</p></li></ul></div><p>
During destroy phase 2 for each widget, the Intrinsics remove the widget
from the modal cascade, unregister all event handlers, remove all key,
keyboard, button, and pointer grabs and remove all callback procedures
registered on the widget. Any outstanding selection transfers will time out.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Dynamic_Constraint_Data_Deallocation_The_ConstraintClassPart_destroy_Procedure"></a>Dynamic Constraint Data Deallocation: The ConstraintClassPart destroy Procedure</h3></div></div></div><p>
The constraint destroy procedure identified in the
<code class="function">ConstraintClassPart</code>
<code class="function">constraintWidgetClass</code>.
This constraint destroy procedure pointer is of type
<a class="xref" href="#XtWidgetProc"><code class="function">XtWidgetProc</code></a>.
The constraint destroy procedures are called in subclass-to-superclass order,
starting at the class of the widget's parent and ending at
<code class="function">constraint\%WidgetClass</code>.
Therefore, a parent's constraint destroy procedure should deallocate only
storage that is specific to the constraint subclass
and not storage allocated by any of its superclasses.
</p><p>
If a parent does not need to deallocate any constraint storage,
the constraint destroy procedure entry
in its class record can be NULL.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Instance_Deallocation_The_deallocate_Procedure"></a>Widget Instance Deallocation: The deallocate Procedure</h3></div></div></div><p>
The deallocate procedure pointer in the
<code class="function">ObjectClassExtension</code>
record is of type
<code class="function">XtDeallocateProc</code>.
</p><div class="funcsynopsis"><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtDeallocateProc)</strong>(</code>Widget <var class="pdparam">widget</var>, XtPointer <var class="pdparam">more_bytes</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget being destroyed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>more_bytes</em></span>
</span></p></td><td><p>
Specifies the auxiliary memory received from the corresponding allocator
along with the widget, or NULL.
</p></td></tr></tbody></table></div><p>
When a widget is destroyed, if an
<code class="function">ObjectClassExtension</code>
record exists in the object class part <span class="emphasis"><em>extension</em></span> field
with <span class="emphasis"><em>record_type</em></span>
<span class="strong"><strong>NULLQUARK</strong></span>
and the <span class="emphasis"><em>deallocate</em></span> field is not NULL, the
<code class="function">XtDeallocateProc</code>
will be called.
If no ObjectClassPart extension record is declared with <span class="emphasis"><em>record_type</em></span>
equal to
<span class="strong"><strong>NULLQUARK</strong></span>,
then
<code class="function">XtInheritAllocate</code>
and
<code class="function">XtInheritDeallocate</code>
are assumed.
The responsibilities of the deallocate procedure are to deallocate the
memory specified by <span class="emphasis"><em>more_bytes</em></span> if it is not NULL,
to deallocate the constraints record as specified by the
widget's <span class="emphasis"><em>core.constraints</em></span> field if it is
not NULL, and to deallocate the widget instance itself.
</p><p>
If no
<code class="function">XtDeallocateProc</code>
is found, it is assumed that the Intrinsics
originally allocated the memory and is responsible for freeing it.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Exiting_from_an_Application"></a>Exiting from an Application</h2></div></div></div><p>
All X Toolkit applications should terminate
by calling
<a class="xref" href="#XtDestroyApplicationContext"><code class="function">XtDestroyApplicationContext</code></a>
and then exiting
using the
standard method for their operating system (typically, by calling
<code class="function">exit</code>
for POSIX-based systems).
The quickest way to make the windows disappear while exiting is to call
<a class="xref" href="#XtUnmapWidget"><code class="function">XtUnmapWidget</code></a>
on each top-level shell widget.
The Intrinsics have no resources beyond those in the program image,
and the X server will free its resources when its connection
to the application is broken.
</p><p>
Depending upon the widget set in use, it may be necessary to explicitly
destroy individual widgets or widget trees with
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
before calling
<a class="xref" href="#XtDestroyApplicationContext"><code class="function">XtDestroyApplicationContext</code></a>
in order to ensure that any
required widget cleanup is properly executed. The application developer
must refer to the widget documentation to learn if a widget needs to
perform cleanup beyond that performed automatically by the
operating system. If the client is a session participant
(see <a class="xref" href="#Session_Participation" title="Session Participation">the section called “Session Participation”</a>), then the client may wish to resign from the session
before exiting. See <a class="xref" href="#Resigning_from_a_Session" title="Resigning from a Session">the section called “Resigning from a Session”</a> for details.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Composite_Widgets_and_Their_Children"></a>Chapter 3. Composite Widgets and Their Children</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Addition_of_Children_to_a_Composite_Widget_The_insert_child_Procedure">Addition of Children to a Composite Widget: The insert_child Procedure</a></span></dt><dt><span class="sect1"><a href="#Insertion_Order_of_Children_The_insert_position_Procedure">Insertion Order of Children: The insert_position Procedure</a></span></dt><dt><span class="sect1"><a href="#Deletion_of_Children_The_delete_child_Procedure">Deletion of Children: The delete_child Procedure</a></span></dt><dt><span class="sect1"><a href="#Adding_and_Removing_Children_from_the_Managed_Set">Adding and Removing Children from the Managed Set</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Managing_Children">Managing Children</a></span></dt><dt><span class="sect2"><a href="#Unmanaging_Children">Unmanaging Children</a></span></dt><dt><span class="sect2"><a href="#Bundling_Changes_to_the_Managed_Set">Bundling Changes to the Managed Set</a></span></dt><dt><span class="sect2"><a href="#Determining_if_a_Widget_Is_Managed">Determining if a Widget Is Managed</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Controlling_When_Widgets_Get_Mapped">Controlling When Widgets Get Mapped</a></span></dt><dt><span class="sect1"><a href="#Constrained_Composite_Widgets">Constrained Composite Widgets</a></span></dt></dl></div><p>
Composite widgets (widgets whose class is a subclass of
<code class="function">compositeWidgetClass</code>)
can have an arbitrary number of children.
Consequently, they are responsible for much more than primitive widgets.
Their responsibilities (either implemented directly by the widget class
or indirectly by Intrinsics functions) include:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Overall management of children from creation to destruction.
</p></li><li class="listitem"><p>
Destruction of descendants when the composite widget is destroyed.
</p></li><li class="listitem"><p>
Physical arrangement (geometry management) of a displayable subset of
children (that is, the managed children).
</p></li><li class="listitem"><p>
Mapping and unmapping of a subset of the managed children.
</p></li></ul></div><p>
Overall management is handled by the generic procedures
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
and
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>.
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
adds children to their parent by calling the parent's insert_child
procedure.
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
removes children from their parent by calling the parent's delete_child
procedure and ensures that all children of a destroyed composite widget
also get destroyed.
</p><p>
Only a subset of the total number of children is actually managed by
the geometry manager and hence possibly visible.
For example, a composite editor widget
supporting multiple editing buffers might allocate one child
widget for each file buffer,
but it might display only a small number of the existing buffers.
Widgets that are in this displayable subset are called managed widgets
and enter into geometry manager calculations.
The other children are called unmanaged widgets
and, by definition, are not mapped by the Intrinsics.
</p><p>
Children are added to and removed from their parent's managed set by using
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>,
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>,
<a class="xref" href="#XtUnmanageChild"><code class="function">XtUnmanageChild</code></a>,
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>,
and
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>,
which notify the parent to recalculate the physical layout of its children
by calling the parent's change_managed procedure.
The
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>
convenience function calls
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
and
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>
on the result.
</p><p>
Most managed children are mapped,
but some widgets can be in a state where they take up physical space
but do not show anything.
Managed widgets are not mapped automatically
if their <span class="emphasis"><em>map_when_managed</em></span> field is
<code class="function">False</code>.
The default is
<code class="function">True</code>
and is changed by using
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>.
</p><p>
Each composite widget class declares a geometry manager,
which is responsible for figuring out where the managed children
should appear within the composite widget's window.
Geometry management techniques fall into four classes:
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">Fixed boxes</span></p></td><td><p>
Fixed boxes have a fixed number of children created by the parent.
All these children are managed,
and none ever makes geometry manager requests.
</p></td></tr><tr><td><p><span class="term">Homogeneous boxes</span></p></td><td><p>
Homogeneous boxes treat all children equally and apply the same geometry
constraints to each child.
Many clients insert and delete widgets freely.
</p></td></tr><tr><td><p><span class="term">Heterogeneous boxes</span></p></td><td><p>
Heterogeneous boxes have a specific location where each child is placed.
This location usually is not specified in pixels,
because the window may be resized, but is expressed rather
in terms of the relationship between a child
and the parent or between the child and other specific children.
The class of heterogeneous boxes is usually a subclass of
Constraint.
</p></td></tr><tr><td><p><span class="term">Shell boxes</span></p></td><td><p>
Shell boxes typically have only one child,
and the child's size is usually
exactly the size of the shell.
The geometry manager must communicate with the window manager, if it exists,
and the box must also accept
<code class="function">ConfigureNotify</code>
events when the window size is changed by the window manager.
</p></td></tr></tbody></table></div><p>
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Addition_of_Children_to_a_Composite_Widget_The_insert_child_Procedure"></a>Addition of Children to a Composite Widget: The insert_child Procedure</h2></div></div></div><p>
To add a child to
the parent's list of children, the
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
function calls the parent's class routine insert_child.
The insert_child procedure pointer in a composite widget is of type
<a class="xref" href="#XtWidgetProc"><code class="function">XtWidgetProc</code></a>.
</p><div class="funcsynopsis"><a id="XtWidgetProc_2"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtWidgetProc)</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Passes the newly created child.
</p></td></tr></tbody></table></div><p>
Most composite widgets inherit their superclass's operation.
The insert_child routine in
<code class="function">CompositeWidgetClass calls the insert_position procedure</code>
and inserts the child at the specified position
in the <span class="emphasis"><em>children</em></span> list, expanding it if necessary.
</p><p>
Some composite widgets define their own insert_child routine
so that they can order their children in some convenient way,
create companion controller widgets for a new widget,
or limit the number or class of their child widgets.
A composite widget class that wishes
to allow nonwidget children (see <a class="xref" href="#Nonwidget_Objects" title="Chapter 12. Nonwidget Objects">Chapter 12, <em>Nonwidget Objects</em></a>) must specify a
<code class="function">CompositeClassExtension</code>
extension record as described
in <a class="xref" href="#CompositeClassPart_Structure" title="CompositeClassPart Structure">the section called “CompositeClassPart Structure”</a>
and set the <span class="emphasis"><em>accepts_objects</em></span> field in this record to
<code class="function">True</code>.
If the
<code class="function">CompositeClassExtension</code>
record is not specified or the
<span class="emphasis"><em>accepts_objects</em></span> field is
<code class="function">False</code>,
the composite widget can assume that all its children are of a subclass of Core
without an explicit subclass test in the insert_child procedure.
</p><p>
If there is not enough room to insert a new child in the <span class="emphasis"><em>children</em></span> array
(that is, <span class="emphasis"><em>num_children</em></span> is equal to <span class="emphasis"><em>num_slots</em></span>),
the insert_child procedure must first reallocate the array
and update <span class="emphasis"><em>num_slots</em></span>.
The insert_child procedure then places the child at the appropriate position
in the array and increments the <span class="emphasis"><em>num_children</em></span> field.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Insertion_Order_of_Children_The_insert_position_Procedure"></a>Insertion Order of Children: The insert_position Procedure</h2></div></div></div><p>
Instances of composite widgets sometimes need to specify more about the order in which
their children are kept.
For example,
an application may want a set of command buttons in some logical order
grouped by function,
and it may want buttons that represent file names to be kept
in alphabetical order without constraining the order in which the
buttons are created.
</p><p>
An application controls the presentation order of a set of children by
supplying an
XtNinsertPosition
resource.
The insert_position procedure pointer in a composite widget instance is of type
<a class="xref" href="#XtOrderProc"><code class="function">(*XtOrderProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtOrderProc"></a><p><code class="funcdef">typedef Cardinal <strong class="fsfunc">(*XtOrderProc)</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Passes the newly created widget.
</p></td></tr></tbody></table></div><p>
Composite widgets that allow clients to order their children (usually
homogeneous boxes) can call their widget instance's insert_position
procedure from the class's insert_child procedure to determine where a new
child should go in its <span class="emphasis"><em>children</em></span> array.
Thus, a client using a composite class can apply different sorting criteria
to widget instances of the class, passing in a different insert_position
procedure resource when it creates each composite widget instance.
</p><p>
The return value of the insert_position procedure
indicates how many children should go before the widget.
Returning zero indicates that the widget should go before all other children,
and returning <span class="emphasis"><em>num_children</em></span> indicates that it should go after all other children.
The default insert_position function returns <span class="emphasis"><em>num_children</em></span>
and can be overridden by a specific composite widget's resource list
or by the argument list provided when the composite widget is created.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Deletion_of_Children_The_delete_child_Procedure"></a>Deletion of Children: The delete_child Procedure</h2></div></div></div><p>
To remove the child from the parent's <span class="emphasis"><em>children</em></span> list, the
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
function eventually causes a call to the Composite parent's class delete_child
procedure.
The delete_child procedure pointer is of type
<a class="xref" href="#XtWidgetProc"><code class="function">XtWidgetProc</code></a>.
</p><div class="funcsynopsis"><a id="_XtWidgetProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtWidgetProc)</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Passes the child being deleted.
</p></td></tr></tbody></table></div><p>
Most widgets inherit the delete_child procedure from their superclass.
Composite widgets that create companion widgets define their own
delete_child procedure to remove these companion widgets.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Adding_and_Removing_Children_from_the_Managed_Set"></a>Adding and Removing Children from the Managed Set</h2></div></div></div><p>
The Intrinsics provide a set of generic routines to permit the addition of
widgets to or the removal of widgets from a composite widget's managed set.
These generic routines eventually call the composite widget's change_managed
procedure if the procedure pointer is non-NULL.
The change_managed procedure pointer is of type
<a class="xref" href="#XtWidgetProc"><code class="function">XtWidgetProc</code></a>.
The widget argument specifies the composite widget whose managed child
set has been modified.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Managing_Children"></a>Managing Children</h3></div></div></div><p>
To add a list of widgets to the geometry-managed (and hence displayable)
subset of their Composite parent, use
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>.
</p><p>typedef Widget *WidgetList;</p><div class="funcsynopsis"><a id="XtManageChildren"></a><p><code class="funcdef">void <strong class="fsfunc">XtManageChildren</strong>(</code>WidgetList <var class="pdparam">children</var>, Cardinal <var class="pdparam">num_children</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>children</em></span>
</span></p></td><td><p>
Specifies a list of child widgets. Each child must be of class
RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_children</em></span>
</span></p></td><td><p>
Specifies the number of children in the list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>
function performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Issues an error if the children do not all have the same parent or
if the parent's class is not a subclass of
<code class="function">compositeWidgetClass</code>.
</p></li><li class="listitem"><p>
Returns immediately if the common parent is being destroyed;
otherwise, for each unique child on the list,
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>
ignores the child if it already is managed or is being destroyed,
and marks it if not.
</p></li><li class="listitem"><p>
If the parent is realized and after all children have been marked,
it makes some of the newly managed children viewable:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
Calls the change_managed routine of the widgets' parent.
</p></li><li class="listitem"><p>
Calls
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
on each previously unmanaged child that is unrealized.
</p></li><li class="listitem"><p>
Maps each previously unmanaged child that has <span class="emphasis"><em>map_when_managed</em></span>
<code class="function">True</code>.
</p></li></ul></div></li></ul></div><p>
Managing children is independent of the ordering of children and
independent of creating and deleting children.
The layout routine of the parent
should consider children whose <span class="emphasis"><em>managed</em></span> field is
<code class="function">True</code>
and should ignore all other children.
Note that some composite widgets, especially fixed boxes, call
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>
from their insert_child procedure.
</p><p>
If the parent widget is realized,
its change_managed procedure is called to notify it
that its set of managed children has changed.
The parent can reposition and resize any of its children.
It moves each child as needed by calling
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>,
which first updates the <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>y</em></span> fields and which then calls
<code class="function">XMoveWindow</code>.
</p><p>
If the composite widget wishes to change the size or border width of any of
its children, it calls
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>,
which first updates the
<span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>, and <span class="emphasis"><em>border_width</em></span>
fields and then calls
<code class="function">XConfigureWindow</code>.
Simultaneous repositioning and resizing may be done with
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>;
see <a class="xref" href="#Widget_Placement_and_Sizing" title="Widget Placement and Sizing">the section called “Widget Placement and Sizing”</a>.
</p><p>
To add a single child to its parent widget's set of managed children, use
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>.
</p><div class="funcsynopsis"><a id="XtManageChild"></a><p><code class="funcdef">void <strong class="fsfunc">XtManageChild</strong>(</code>Widget <var class="pdparam">child</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>child</em></span>
</span></p></td><td><p>
Specifies the child. Must be of class RectObj or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>
function constructs a
<code class="function">WidgetList</code>
of length 1 and calls
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>.
</p><p>
To create and manage a child widget in a single procedure, use
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>
or
<a class="xref" href="#XtVaCreateManagedWidget"><code class="function">XtVaCreateManagedWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtCreateManagedWidget"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtCreateManagedWidget</strong>(</code>String <var class="pdparam">name</var>, WidgetClass <var class="pdparam">widget_class</var>, Widget <var class="pdparam">parent</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the resource instance name for the created widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class pointer for the created widget. (rC
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>parent</em></span>
</span></p></td><td><p>
Specifies the parent widget. Must be of class Composite or any
subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any other resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>
function is a convenience routine that calls
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
and
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>.
</p><div class="funcsynopsis"><a id="XtVaCreateManagedWidget"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtVaCreateManagedWidget</strong>(</code>String <var class="pdparam">name</var>, WidgetClass <var class="pdparam">widget_class</var>, Widget <var class="pdparam">parent</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the resource instance name for the created widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class pointer for the created widget. (rC
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>parent</em></span>
</span></p></td><td><p>
Specifies the parent widget. Must be of class Composite or any
subclass thereof.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaCreateManagedWidget"><code class="function">XtVaCreateManagedWidget</code></a>
is identical in function to
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced
by a varargs list, as described in Section 2.5.1.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Unmanaging_Children"></a>Unmanaging Children</h3></div></div></div><p>
To remove a list of children from a parent widget's managed list, use
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>.
</p><div class="funcsynopsis"><a id="XtUnmanageChildren"></a><p><code class="funcdef">void <strong class="fsfunc">XtUnmanageChildren</strong>(</code>WidgetList <var class="pdparam">children</var>, Cardinal <var class="pdparam">num_children</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>children</em></span>
</span></p></td><td><p>
Specifies a list of child widgets. Each child must be of class
RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_children</em></span>
</span></p></td><td><p>
Specifies the number of children.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>
function performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Returns immediately if the common parent is being destroyed.
</p></li><li class="listitem"><p>
Issues an error if the children do not all have the same parent
or if the parent is not a subclass of
<code class="function">compositeWidgetClass</code>.
</p></li><li class="listitem"><p>
For each unique child on the list,
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>
ignores the child if it is unmanaged; otherwise it performs the following:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
Marks the child as unmanaged.
</p></li><li class="listitem"><p>
If the child is realized and the <span class="emphasis"><em>map_when_managed</em></span> field is
<code class="function">True</code>,
it is unmapped.
</p></li></ul></div></li><li class="listitem"><p>
If the parent is realized and if any children have become unmanaged,
calls the change_managed routine of the widgets' parent.
</p></li></ul></div><p>
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>
does not destroy the child widgets.
Removing widgets from a parent's managed set is often a temporary banishment,
and some time later the client may manage the children again.
To destroy widgets entirely,
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
should be called instead;
see <a class="xref" href="#Exiting_from_an_Application" title="Exiting from an Application">the section called “Exiting from an Application”</a>.
</p><p>
To remove a single child from its parent widget's managed set, use
<a class="xref" href="#XtUnmanageChild"><code class="function">XtUnmanageChild</code></a>.
</p><div class="funcsynopsis"><a id="XtUnmanageChild"></a><p><code class="funcdef">void <strong class="fsfunc">XtUnmanageChild</strong>(</code>Widget <var class="pdparam">child</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>child</em></span>
</span></p></td><td><p>
Specifies the child. Must be of class RectObj or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtUnmanageChild"><code class="function">XtUnmanageChild</code></a>
function constructs a widget list
of length 1 and calls
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>.
</p><p>
These functions are low-level routines that are used by generic
composite widget building routines.
In addition, composite widgets can provide widget-specific,
high-level convenience procedures.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Bundling_Changes_to_the_Managed_Set"></a>Bundling Changes to the Managed Set</h3></div></div></div><p>
A client may simultaneously unmanage and manage children
with a single call to the Intrinsics. In this same call the
client may provide a callback procedure that can modify the
geometries of one or more children. The composite widget class
defines whether this single client call results in separate invocations
of the change_managed method, one to unmanage and the other to
manage, or in just a single invocation.
</p><p>
To simultaneously remove from and add to the geometry-managed
set of children of a composite parent, use
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>.
</p><div class="funcsynopsis"><a id="XtChangeManagedSet"></a><p><code class="funcdef">void <strong class="fsfunc">XtChangeManagedSet</strong>(</code>WidgetList <var class="pdparam">unmanage_children</var>, Cardinal <var class="pdparam">num_unmanage_children</var>, XtDoChangeProc <var class="pdparam">do_change_proc</var>, XtPointer <var class="pdparam">client_data</var>, WidgetList <var class="pdparam">manage_children</var>, Cardinal <var class="pdparam">num_manage_children</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>unmanage_children</em></span>
</span></p></td><td><p>
Specifies the list of widget children to initially remove from the managed set.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_unmanage_children</em></span>
</span></p></td><td><p>
Specifies the number of entries in the <span class="emphasis"><em>unmanage_children</em></span> list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>do_change_proc</em></span>
</span></p></td><td><p>
Specifies a procedure to invoke between unmanaging
and managing the children, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies client data to be passed to the do_change_proc.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>manage_children</em></span>
</span></p></td><td><p>
Specifies the list of widget children to finally add to the managed set.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_manage_children</em></span>
</span></p></td><td><p>
Specifies the number of entries in the <span class="emphasis"><em>manage_children</em></span> list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>
function performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Returns immediately if <span class="emphasis"><em>num_unmanage_children</em></span> and
<span class="emphasis"><em>num_manage_children</em></span> are both 0.
</p></li><li class="listitem"><p>
Issues a warning and returns if the widgets specified in the
<span class="emphasis"><em>manage_children</em></span> and
the <span class="emphasis"><em>unmanage_children</em></span> lists do not all have the same parent or if
that parent is not a subclass of
<code class="function">compositeWidgetClass</code>.
</p></li><li class="listitem"><p>
Returns immediately if the common parent is being destroyed.
</p></li><li class="listitem"><p>
If <span class="emphasis"><em>do_change_proc</em></span> is not NULL and the parent's
<code class="function">CompositeClassExtension</code>
<span class="emphasis"><em>allows_change_managed_set</em></span> field is
<code class="function">False</code>,
then
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>
performs the following:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
Calls
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>
(<span class="emphasis"><em>unmanage_children</em></span>, <span class="emphasis"><em>num_unmanage_children</em></span>).
</p></li><li class="listitem"><p>
Calls the <span class="emphasis"><em>do_change_proc</em></span>.
</p></li><li class="listitem"><p>
Calls
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>
(<span class="emphasis"><em>manage_children</em></span>, <span class="emphasis"><em>num_manage_children</em></span>).
</p></li></ul></div></li><li class="listitem"><p>
Otherwise, the following is performed:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
For each child on the <span class="emphasis"><em>unmanage_children</em></span> list; if the child is
already unmanaged it is ignored, otherwise it is marked as unmanaged,
and if it is realized and its <span class="emphasis"><em>map_when_managed</em></span> field is
<code class="function">True</code>,
it is unmapped.
</p></li><li class="listitem"><p>
If <span class="emphasis"><em>do_change_proc</em></span> is non-NULL, the procedure is invoked.
</p></li><li class="listitem"><p>
For each child on the <span class="emphasis"><em>manage_children</em></span> list; if the child is already
managed or is being destroyed, it is ignored; otherwise it is
marked as managed.
</p></li><li class="listitem"><p>
If the parent is realized and after all children have been marked,
the change_managed method of the parent is invoked, and subsequently
some of the newly managed children are made viewable by calling
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
on each previously unmanaged child that is unrealized and
mapping each previously unmanaged child that has <span class="emphasis"><em>map_when_managed</em></span>
<code class="function">True</code>.
</p></li></ul></div></li></ul></div><p>
If no
<code class="function">CompositeClassExtension</code>
record is found in the parent's composite class part <span class="emphasis"><em>extension</em></span> field
with record type
<span class="strong"><strong>NULLQUARK</strong></span>
and version greater than 1, and if
<code class="function">XtInheritChangeManaged</code>
was specified in the parent's class record during class initialization,
the value of the <span class="emphasis"><em>allows_change_managed_set</em></span>
field is inherited from the superclass. The value inherited from
<code class="function">compositeWidgetClass</code>
for the <span class="emphasis"><em>allows_change_managed_set</em></span> field is
<code class="function">False</code>.
</p><p>
It is not an error to include a child in both the <span class="emphasis"><em>unmanage_children</em></span>
and the <span class="emphasis"><em>manage_children</em></span> lists. The effect of such a call is that
the child remains managed following the call, but the <span class="emphasis"><em>do_change_proc</em></span> is
able to affect the child while it is in an unmanaged state.
</p><p>
The <span class="emphasis"><em>do_change_proc</em></span> is of type
<a class="xref" href="#XtDoChangeProc"><code class="function">*XtDoChangeProc</code></a>.
</p><div class="funcsynopsis"><a id="XtDoChangeProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">*XtDoChangeProc</strong>(</code>Widget <var class="pdparam">composite_parent</var>, WidgetList <var class="pdparam">unmange_children</var>, Cardinal *<var class="pdparam">num_unmanage_children</var>, WidgetList <var class="pdparam">manage_children</var>, Cardinal *<var class="pdparam">num_manage_children</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>composite_parent</em></span>
</span></p></td><td><p>
Passes the composite parent whose managed set is being altered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>unmanage_children</em></span>
</span></p></td><td><p>
Passes the list of children just removed from the managed set.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_unmanage_children</em></span>
</span></p></td><td><p>
Passes the number of entries in the <span class="emphasis"><em>unmanage_children</em></span> list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>manage_children</em></span>
</span></p></td><td><p>
Passes the list of children about to be added to the managed set.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_manage_children</em></span>
</span></p></td><td><p>
Passes the number of entries in the <span class="emphasis"><em>manage_children</em></span> list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Passes the client data passed to
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>.
</p></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>do_change_proc</em></span> procedure is used by the caller of
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>
to make changes to one or more children at the point when the
managed set contains the fewest entries. These changes may
involve geometry requests, and in this case the caller of
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>
may take advantage of the fact that the Intrinsics internally grant
geometry requests made by unmanaged children without invoking
the parent's geometry manager. To achieve this advantage, if
the <span class="emphasis"><em>do_change_proc</em></span> procedure
changes the geometry of a child or of a descendant of a child, then
that child should be included in the <span class="emphasis"><em>unmanage_children</em></span> and
<span class="emphasis"><em>manage_children</em></span> lists.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Determining_if_a_Widget_Is_Managed"></a>Determining if a Widget Is Managed</h3></div></div></div><p>
To determine the managed state of a given child widget, use
<a class="xref" href="#XtIsManaged"><code class="function">XtIsManaged</code></a>.
</p><div class="funcsynopsis"><a id="XtIsManaged"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtIsManaged</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtIsManaged"><code class="function">XtIsManaged</code></a>
function returns
<code class="function">True</code>
if the specified widget is of class RectObj or any subclass thereof
and is managed, or
<code class="function">False</code>
otherwise.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Controlling_When_Widgets_Get_Mapped"></a>Controlling When Widgets Get Mapped</h2></div></div></div><p>
A widget is normally mapped if it is managed.
However,
this behavior can be overridden by setting the XtNmappedWhenManaged resource
for the widget when it is created
or by setting the <span class="emphasis"><em>map_when_managed</em></span> field to
<code class="function">False</code>.
</p><p>
To change the value of a given widget's <span class="emphasis"><em>map_when_managed</em></span> field, use
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>.
</p><div class="funcsynopsis"><a id="XtSetMappedWhenManaged"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetMappedWhenManaged</strong>(</code>Widget <var class="pdparam">w</var>, Boolean <var class="pdparam">map_when_managed</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>map_when_managed</em></span>
</span></p></td><td><p>
Specifies a Boolean value that indicates the new value
that is stored into the widget's <span class="emphasis"><em>map_when_managed</em></span>
field.
</p></td></tr></tbody></table></div><p>
If the widget is realized and managed,
and if <span class="emphasis"><em>map_when_managed</em></span> is
<code class="function">True</code>,
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>
maps the window.
If the widget is realized and managed,
and if <span class="emphasis"><em>map_when_managed</em></span> is
<code class="function">False</code>,
it unmaps the window.
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>
is a convenience function that is equivalent to (but slightly faster than)
calling
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
and setting the new value for the XtNmappedWhenManaged resource
then mapping the widget as appropriate.
As an alternative to using
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>
to control mapping,
a client may set <span class="emphasis"><em>mapped_when_managed</em></span> to
<code class="function">False</code>
and use
<a class="xref" href="#XtMapWidget"><code class="function">XtMapWidget</code></a>
and
<a class="xref" href="#XtUnmapWidget"><code class="function">XtUnmapWidget</code></a>
explicitly.
</p><p>
To map a widget explicitly, use
<a class="xref" href="#XtMapWidget"><code class="function">XtMapWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtMapWidget"></a><p><code class="funcdef"> <strong class="fsfunc">XtMapWidget</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
To unmap a widget explicitly, use
<a class="xref" href="#XtUnmapWidget"><code class="function">XtUnmapWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtUnmapWidget"></a><p><code class="funcdef"> <strong class="fsfunc">XtUnmapWidget</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Constrained_Composite_Widgets"></a>Constrained Composite Widgets</h2></div></div></div><p>
The Constraint
widget class is a subclass of
<code class="function">compositeWidgetClass</code>.
The name is derived from the fact that constraint widgets
may manage the geometry
of their children based on constraints associated with each child.
These constraints can be as simple as the maximum width and height
the parent will allow the child to occupy or can be as complicated as
how other children should change if this child is moved or resized.
Constraint
widgets let a parent define constraints as resources that are supplied for their children.
For example, if the
Constraint
parent defines the maximum sizes for its children,
these new size resources are retrieved for each child as if they were
resources that were defined by the child widget's class.
Accordingly,
constraint resources may be included in the argument list or resource file just
like any other resource for the child.
</p><p>
Constraint
widgets have all the responsibilities of normal composite widgets
and, in addition, must process and act upon the constraint information
associated with each of their children.
</p><p>
To make it easy for widgets and the Intrinsics to keep track of the
constraints associated with a child,
every widget has a <span class="emphasis"><em>constraints</em></span> field,
which is the address of a parent-specific structure that contains
constraint information about the child.
If a child's parent does not belong to a subclass of
<code class="function">constraintWidgetClass</code>,
then the child's <span class="emphasis"><em>constraints</em></span> field is NULL.
</p><p>
Subclasses of
Constraint
can add constraint data to the constraint record defined by their superclass.
To allow this, widget writers should define the constraint
records in their private .h file by using the same conventions as used for
widget records.
For example, a widget class that needs to maintain a maximum
width and height for each child might define its constraint record as
follows:
</p><div class="literallayout"><p><br />
typedef struct {<br />
Dimension max_width, max_height;<br />
} MaxConstraintPart;<br />
typedef struct {<br />
MaxConstraintPart max;<br />
} MaxConstraintRecord, *MaxConstraint;<br />
</p></div><p>
A subclass of this widget class that also needs to maintain a minimum size would
define its constraint record as follows:
</p><div class="literallayout"><p><br />
typedef struct {<br />
Dimension min_width, min_height;<br />
} MinConstraintPart;<br />
typedef struct {<br />
MaxConstraintPart max;<br />
MinConstraintPart min;<br />
} MaxMinConstraintRecord, *MaxMinConstraint;<br />
</p></div><p>
Constraints are allocated, initialized, deallocated, and otherwise maintained
insofar as possible by the Intrinsics.
The Constraint class record part has several entries that facilitate this.
All entries in
<code class="function">ConstraintClassPart</code>
are fields and procedures that are defined and implemented by the parent,
but they are called whenever actions are performed on the parent's children.
</p><p>
The
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
function uses the <span class="emphasis"><em>constraint_size</em></span> field in the parent's class record
to allocate a constraint record when a child is created.
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
also uses the constraint resources to fill in resource fields in the
constraint record associated with a child.
It then calls the constraint initialize procedure so that the parent
can compute constraint fields that are derived from constraint resources
and can possibly move or resize the child to conform to the given constraints.
</p><p>
When the
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
and
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
functions are executed
on a child, they use the constraint resources to get the values or
set the values of constraints associated with that child.
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
then calls the constraint set_values procedures so that the parent can
recompute derived constraint fields and move or resize the child
as appropriate.
If a
Constraint
widget class or any of its superclasses have declared a
<code class="function">ConstraintClassExtension</code>
record in the
<code class="function">ConstraintClassPart</code>
<span class="emphasis"><em>extension</em></span>
fields with a record type of
<span class="strong"><strong>NULLQUARK</strong></span>
and the <span class="emphasis"><em>get_values_hook</em></span> field in
the extension record is non-NULL,
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
calls the get_values_hook
procedure(s) to allow the parent to return derived constraint fields.
</p><p>
The
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
function calls the constraint destroy procedure to deallocate any
dynamic storage associated with a constraint record.
The constraint record itself must not be deallocated by the constraint
destroy procedure;
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
does this automatically.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Shell_Widgets"></a>Chapter 4. Shell Widgets</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Shell_Widget_Definitions">Shell Widget Definitions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#ShellClassPart_Definitions">ShellClassPart Definitions</a></span></dt><dt><span class="sect2"><a href="#ShellPart_Definition">ShellPart Definition</a></span></dt><dt><span class="sect2"><a href="#Shell_Resources">Shell Resources</a></span></dt><dt><span class="sect2"><a href="#ShellPart_Default_Values">ShellPart Default Values</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Session_Participation">Session Participation</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Joining_a_Session">Joining a Session</a></span></dt><dt><span class="sect2"><a href="#Saving_Application_State">Saving Application State</a></span></dt><dt><span class="sect2"><a href="#Responding_to_a_Shutdown">Responding to a Shutdown</a></span></dt><dt><span class="sect2"><a href="#Resigning_from_a_Session">Resigning from a Session</a></span></dt></dl></dd></dl></div><p>
Shell widgets hold an application's top-level widgets to allow them to
communicate with the window manager and session manager.
Shells have been designed to be as nearly invisible as possible.
Clients have to create them,
but they should never have to worry about their sizes.
</p><p>
If a shell widget is resized from the outside (typically by a window manager),
the shell widget also resizes its managed child widget automatically.
Similarly, if the shell's child widget needs to change size,
it can make a geometry request to the shell,
and the shell negotiates the size change with the outer environment.
Clients should never attempt to change the size of their shells directly.
</p><p>The five types of public shells are:</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">OverrideShell</span></p></td><td><p>
Used for shell windows that completely bypass the window manager
(for example, pop-up menu shells).
</p></td></tr><tr><td><p><span class="term">TransientShell</span></p></td><td><p>Used for shell windows that have the
<span class="strong"><strong>WM_TRANSIENT_FOR</strong></span>
property set. The effect of this property is dependent upon the
window manager being used.
</p></td></tr><tr><td><p><span class="term">TopLevelShell</span></p></td><td><p>Used for normal top-level windows
(for example, any additional top-level widgets an application needs).
</p></td></tr><tr><td><p><span class="term">ApplicationShell</span></p></td><td><p>Formerly used for the single main top-level window that
the window manager identifies as an application instance and
made obsolete by SessionShell.
</p></td></tr><tr><td><p><span class="term">SessionShell</span></p></td><td><p>
Used for the single main top-level window that
the window manager identifies as an application instance and
that interacts with the session manager.
</p></td></tr></tbody></table></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Shell_Widget_Definitions"></a>Shell Widget Definitions</h2></div></div></div><p>
Widgets negotiate their size and position with their parent widget,
that is, the widget that directly contains them.
Widgets at the top of the hierarchy do not have parent widgets.
Instead, they must deal with the outside world.
To provide for this,
each top-level widget is encapsulated in a special widget, called a
shell widget.
</p><p>
Shell
widgets, whose class is a subclass of the
Composite class,
encapsulate other widgets and can allow a widget to avoid the
geometry clipping imposed by the parent-child window relationship.
They also can provide a layer of communication with the window manager.
</p><p>The eight different types of shells are:</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">Shell</span></p></td><td><p>The base class for shell widgets; provides the
fields needed for all types of shells. Shell
is a direct subclass of
<span class="strong"><strong>compositeWidgetClass</strong></span>.
</p></td></tr><tr><td><p><span class="term">OverrideShell</span></p></td><td><p>A subclass of Shell; used for shell windows that completely
bypass the window manager.</p></td></tr><tr><td><p><span class="term">WMShell</span></p></td><td><p>A subclass of Shell; contains fields needed by the
common window manager protocol.</p></td></tr><tr><td><p><span class="term">VendorShell</span></p></td><td><p>A subclass of WMShell; contains fields used by
vendor-specific window managers.
</p></td></tr><tr><td><p><span class="term">TransientShell</span></p></td><td><p>A subclass of VendorShell; used for shell windows that
desire the <span class="strong"><strong>WM_TRANSIENT_FOR</strong></span>
property.</p></td></tr><tr><td><p><span class="term">TopLevelShell</span></p></td><td><p>A subclass of VendorShell; used for normal top-level windows.
</p></td></tr><tr><td><p><span class="term">ApplicationShell</span></p></td><td><p>A subclass of TopLevelShell; may be used for an application's additional
root windows.</p></td></tr><tr><td><p><span class="term">SessionShell</span></p></td><td><p>A subclass of ApplicationShell; used for an application's
main root window.</p></td></tr></tbody></table></div><p>
Note that the classes
Shell,
WMShell,
and
VendorShell
are internal and should not be instantiated or subclassed.
Only
OverrrideShell,
TransientShell,
TopLevelShell,
ApplicationShell,
and
SessionShell
are intended for public use.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ShellClassPart_Definitions"></a>ShellClassPart Definitions</h3></div></div></div><p>
Only the Shell
class has additional class fields, which are all contained in the
<code class="function">ShellClassExtensionRec</code>.
None of the other Shell classes have any additional class fields:
</p><div class="literallayout"><p><br />
typedef struct {<br />
XtPointer extension;<br />
} ShellClassPart, OverrideShellClassPart,<br />
WMShellClassPart, VendorShellClassPart, TransientShellClassPart,<br />
TopLevelShellClassPart, ApplicationShellClassPart, SessionShellClassPart;<br />
</p></div><p>The full Shell class record definitions are:</p><div class="literallayout"><p><br />
typedef struct _ShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
} ShellClassRec;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
XtPointer next_extension; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
XrmQuark record_type; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
long version; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
Cardinal record_size; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
XtGeometryHandler root_geometry_manager; See below<br />
} ShellClassExtensionRec, *ShellClassExtension;<br />
</p></div><div class="literallayout"><p><br />
typedef struct _OverrideShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
OverrideShellClassPart override_shell_class;<br />
} OverrideShellClassRec;<br />
</p></div><div class="literallayout"><p><br />
typedef struct _WMShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
WMShellClassPart wm_shell_class;<br />
} WMShellClassRec;<br />
</p></div><div class="literallayout"><p><br />
typedef struct _VendorShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
WMShellClassPart wm_shell_class;<br />
VendorShellClassPart vendor_shell_class;<br />
} VendorShellClassRec;<br />
</p></div><div class="literallayout"><p><br />
typedef struct _TransientShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
WMShellClassPart wm_shell_class;<br />
VendorShellClassPart vendor_shell_class;<br />
TransientShellClassPart transient_shell_class;<br />
} TransientShellClassRec;<br />
</p></div><div class="literallayout"><p><br />
typedef struct _TopLevelShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
WMShellClassPart wm_shell_class;<br />
VendorShellClassPart vendor_shell_class;<br />
TopLevelShellClassPart top_level_shell_class;<br />
} TopLevelShellClassRec;<br />
</p></div><div class="literallayout"><p><br />
typedef struct _ApplicationShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
WMShellClassPart wm_shell_class;<br />
VendorShellClassPart vendor_shell_class;<br />
TopLevelShellClassPart top_level_shell_class;<br />
ApplicationShellClassPart application_shell_class;<br />
} ApplicationShellClassRec;<br />
</p></div><div class="literallayout"><p><br />
typedef struct _SessionShellClassRec {<br />
CoreClassPart core_class;<br />
CompositeClassPart composite_class;<br />
ShellClassPart shell_class;<br />
WMShellClassPart wm_shell_class;<br />
VendorShellClassPart vendor_shell_class;<br />
TopLevelShellClassPart top_level_shell_class;<br />
ApplicationShellClassPart application_shell_class;<br />
SessionShellClassPart session_shell_class;<br />
} SessionShellClassRec;<br />
</p></div><p>
The single occurrences of the class records and pointers for creating
instances of shells are:
</p><div class="literallayout"><p><br />
extern ShellClassRec shellClassRec;<br />
extern OverrideShellClassRec overrideShellClassRec;<br />
extern WMShellClassRec wmShellClassRec;<br />
extern VendorShellClassRec vendorShellClassRec;<br />
extern TransientShellClassRec transientShellClassRec;<br />
extern TopLevelShellClassRec topLevelShellClassRec;<br />
extern ApplicationShellClassRec applicationShellClassRec;<br />
extern SessionShellClassRec sessionShellClassRec;<br />
extern WidgetClass shellWidgetClass;<br />
extern WidgetClass overrideShellWidgetClass;<br />
extern WidgetClass wmShellWidgetClass;<br />
extern WidgetClass vendorShellWidgetClass;<br />
extern WidgetClass transientShellWidgetClass;<br />
extern WidgetClass topLevelShellWidgetClass;<br />
extern WidgetClass applicationShellWidgetClass;<br />
extern WidgetClass sessionShellWidgetClass;<br />
</p></div><p>
The following opaque types and opaque variables are defined
for generic operations on widgets whose class is a subclass of
Shell.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Types</th><th align="left">Variables</th></tr></thead><tbody><tr><td align="left"><span class="strong"><strong>ShellWidget</strong></span></td><td align="left"><span class="strong"><strong>shellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>OverrideShellWidget</strong></span></td><td align="left"><span class="strong"><strong>overrideShellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>WMShellWidget</strong></span></td><td align="left"><span class="strong"><strong>wmShellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>VendorShellWidget</strong></span></td><td align="left"><span class="strong"><strong>vendorShellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>TransientShellWidget</strong></span></td><td align="left"><span class="strong"><strong>transientShellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>TopLevelShellWidget</strong></span></td><td align="left"><span class="strong"><strong>topLevelShellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>ApplicationShellWidget</strong></span></td><td align="left"><span class="strong"><strong>applicationShellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>SessionShellWidget</strong></span></td><td align="left"><span class="strong"><strong>sessionShellWidgetClass</strong></span></td></tr><tr><td align="left"><span class="strong"><strong>ShellWidgetClass</strong></span></td><td align="left"> </td></tr><tr><td align="left"><span class="strong"><strong>OverrideShellWidgetClass</strong></span></td><td align="left"> </td></tr><tr><td align="left"><span class="strong"><strong>WMShellWidgetClass</strong></span></td><td align="left"> </td></tr><tr><td align="left"><span class="strong"><strong>VendorShellWidgetClass</strong></span></td><td align="left"> </td></tr><tr><td align="left"><span class="strong"><strong>TransientShellWidgetClass</strong></span></td><td align="left"> </td></tr><tr><td align="left"><span class="strong"><strong>TopLevelShellWidgetClass</strong></span></td><td align="left"> </td></tr><tr><td align="left"><span class="strong"><strong>ApplicationShellWidgetClass</strong></span></td><td align="left"> </td></tr><tr><td align="left"><span class="strong"><strong>SessionShellWidgetClass</strong></span></td><td align="left"> </td></tr></tbody></table></div><p>
The declarations for all Intrinsics-defined shells except
VendorShell appear in
<code class="function">Shell.h</code>
and
<code class="function">ShellP.h</code>.
VendorShell has separate public and private .h files which are included by
<code class="function">Shell.h</code>
and
<code class="function">ShellP.h</code>.
</p><p>
<code class="function">Shell.h</code>
uses incomplete structure definitions to ensure that the
compiler catches attempts to access private data in any of the Shell
instance or class data structures.
</p><p>
The symbolic constant for the
<code class="function">ShellClassExtension</code>
version identifier is
<code class="function">XtShellExtensionVersion</code>
(see <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a>).
</p><p>
The root_geometry_manager procedure acts as
the parent geometry manager for geometry requests made by shell
widgets. When a shell widget calls either
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
or
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>,
the root_geometry_manager procedure is invoked to
negotiate the new geometry with the window manager. If the window
manager permits the new geometry, the root_geometry_manager
procedure should
return
<code class="function">XtGeometryYes</code>;
if the window manager denies the geometry
request or does not change the window geometry within some timeout
interval (equal to <span class="emphasis"><em>wm_timeout</em></span> in the case of WMShells), the
root_geometry_manager procedure should return
<code class="function">XtGeometryNo</code>.
If the window manager makes some alternative geometry change, the
root_geometry_manager procedure may return either
<code class="function">XtGeometryNo</code>
and handle the new geometry as a resize or
<code class="function">XtGeometryAlmost</code>
in anticipation that the shell will accept the compromise. If the
compromise is not accepted, the new size must then be handled as a
resize. Subclasses of
Shell
that wish to provide their own
root_geometry_manager procedures are strongly encouraged to use enveloping to
invoke their superclass's root_geometry_manager procedure under most
situations, as the window manager interaction may be very complex.
</p><p>
If no
<code class="function">ShellClassPart</code>
extension record is declared with <span class="emphasis"><em>record_type</em></span>
equal to
<span class="strong"><strong>NULLQUARK</strong></span>,
then
<code class="function">XtInheritRootGeometryManager</code>
is assumed.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ShellPart_Definition"></a>ShellPart Definition</h3></div></div></div><p>
The various shell widgets have the following additional instance
fields defined in
their widget records:
</p><div class="literallayout"><p><br />
typedef struct {<br />
String geometry;<br />
XtCreatePopupChildProc create_popup_child_proc;<br />
XtGrabKind grab_kind;<br />
Boolean spring_loaded;<br />
Boolean popped_up;<br />
Boolean allow_shell_resize;<br />
Boolean client_specified;<br />
Boolean save_under;<br />
Boolean override_redirect;<br />
XtCallbackList popup_callback;<br />
XtCallbackList popdown_callback;<br />
Visual * visual;<br />
} ShellPart;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
int empty;<br />
} OverrideShellPart;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
String title;<br />
int wm_timeout;<br />
Boolean wait_for_wm;<br />
Boolean transient;<br />
Boolean urgency;<br />
Widget client_leader;<br />
String window_role;<br />
struct _OldXSizeHints {<br />
long flags;<br />
int x, y;<br />
int width, height;<br />
int min_width, min_height;<br />
int max_width, max_height;<br />
int width_inc, height_inc;<br />
struct {<br />
int x;<br />
int y;<br />
} min_aspect, max_aspect;<br />
} size_hints;<br />
XWMHints wm_hints;<br />
int base_width, base_height, win_gravity;<br />
Atom title_encoding;<br />
} WMShellPart;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
int vendor_specific;<br />
} VendorShellPart;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
Widget transient_for;<br />
} TransientShellPart;<br />
typedef struct {<br />
String icon_name;<br />
Boolean iconic;<br />
Atom icon_name_encoding;<br />
} TopLevelShellPart;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
char * class;<br />
XrmClass xrm_class;<br />
int argc;<br />
char ** argv;<br />
} ApplicationShellPart;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
SmcConn connection;<br />
String session_id;<br />
String * restart_command;<br />
String * clone_command;<br />
String * discard_command;<br />
String * resign_command;<br />
String * shutdown_command;<br />
String * environment;<br />
String current_dir;<br />
String program_path;<br />
unsigned char restart_style;<br />
Boolean join_session;<br />
XtCallbackList save_callbacks;<br />
XtCallbackList interact_callbacks;<br />
XtCallbackList cancel_callbacks;<br />
XtCallbackList save_complete_callbacks;<br />
XtCallbackList die_callbacks;<br />
XtCallbackList error_callbacks;<br />
} SessionShellPart;<br />
</p></div><p>
The full shell widget instance record definitions are:
</p><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
} ShellRec, *ShellWidget;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
OverrideShellPart override;<br />
} OverrideShellRec, *OverrideShellWidget;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
WMShellPart wm;<br />
} WMShellRec, *WMShellWidget;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
WMShellPart wm;<br />
VendorShellPart vendor;<br />
} VendorShellRec, *VendorShellWidget;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
WMShellPart wm;<br />
VendorShellPart vendor;<br />
TransientShellPart transient;<br />
} TransientShellRec, *TransientShellWidget;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
WMShellPart wm;<br />
VendorShellPart vendor;<br />
TopLevelShellPart topLevel;<br />
} TopLevelShellRec, *TopLevelShellWidget;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
WMShellPart wm;<br />
VendorShellPart vendor;<br />
TopLevelShellPart topLevel;<br />
ApplicationShellPart application;<br />
} ApplicationShellRec, *ApplicationShellWidget;<br />
</p></div><div class="literallayout"><p><br />
typedef struct {<br />
CorePart core;<br />
CompositePart composite;<br />
ShellPart shell;<br />
WMShellPart wm;<br />
VendorShellPart vendor;<br />
TopLevelShellPart topLevel;<br />
ApplicationShellPart application;<br />
SessionShellPart session;<br />
} SessionShellRec, *SessionShellWidget;<br />
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Shell_Resources"></a>Shell Resources</h3></div></div></div><p>
The resource names, classes, and representation types specified in
the
<code class="function">shellClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNallowShellResize</td><td align="left">XtCAllowShellResize</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNcreatePopupChildProc</td><td align="left">XtCCreatePopupChildProc</td><td align="left">XtRFunction</td></tr><tr><td align="left">XtNgeometry</td><td align="left">XtCGeometry</td><td align="left">XtRString</td></tr><tr><td align="left">XtNoverrideRedirect</td><td align="left">XtCOverrideRedirect</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNpopdownCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNpopupCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNsaveUnder</td><td align="left">XtCSaveUnder</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNvisual</td><td align="left">XtCVisual</td><td align="left">XtRVisual</td></tr></tbody></table></div><p>
OverrideShell
declares no additional resources beyond those defined by
Shell.
</p><p>
The resource names, classes, and representation types specified in
the
<code class="function">wmShellClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNbaseHeight</td><td align="left">XtCBaseHeight</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNbaseWidth</td><td align="left">XtCBaseWidth</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNclientLeader</td><td align="left">XtCClientLeader</td><td align="left">XtRWidget</td></tr><tr><td align="left">XtNheightInc</td><td align="left">XtCHeightInc</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNiconMask</td><td align="left">XtCIconMask</td><td align="left">XtRBitmap</td></tr><tr><td align="left">XtNiconPixmap</td><td align="left">XtCIconPixmap</td><td align="left">XtRBitmap</td></tr><tr><td align="left">XtNiconWindow</td><td align="left">XtCIconWindow</td><td align="left">XtRWindow</td></tr><tr><td align="left">XtNiconX</td><td align="left">XtCIconX</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNiconY</td><td align="left">XtCIconY</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNinitialState</td><td align="left">XtCInitialState</td><td align="left">XtRInitialState</td></tr><tr><td align="left">XtNinput</td><td align="left">XtCInput</td><td align="left">XtRBool</td></tr><tr><td align="left">XtNmaxAspectX</td><td align="left">XtCMaxAspectX</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNmaxAspectY</td><td align="left">XtCMaxAspectY</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNmaxHeight</td><td align="left">XtCMaxHeight</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNmaxWidth</td><td align="left">XtCMaxWidth</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNminAspectX</td><td align="left">XtCMinAspectX</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNminAspectY</td><td align="left">XtCMinAspectY</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNminHeight</td><td align="left">XtCMinHeight</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNminWidth</td><td align="left">XtCMinWidth</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNtitle</td><td align="left">XtCTitle</td><td align="left">XtRString</td></tr><tr><td align="left">XtNtitleEncoding</td><td align="left">XtCTitleEncoding</td><td align="left">XtRAtom</td></tr><tr><td align="left">XtNtransient</td><td align="left">XtCTransient</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNwaitforwm, XtNwaitForWm</td><td align="left">XtCWaitforwm, XtCWaitForWm</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNwidthInc</td><td align="left">XtCWidthInc</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNwindowRole</td><td align="left">XtCWindowRole</td><td align="left">XtRString</td></tr><tr><td align="left">XtNwinGravity</td><td align="left">XtCWinGravity</td><td align="left">XtRGravity</td></tr><tr><td align="left">XtNwindowGroup</td><td align="left">XtCWindowGroup</td><td align="left">XtRWindow</td></tr><tr><td align="left">XtNwmTimeout</td><td align="left">XtCWmTimeout</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNurgency</td><td align="left">XtCUrgency</td><td align="left">XtRBoolean</td></tr><tr><td align="left">_</td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div><p>
The class resource list for
VendorShell
is implementation-defined.
</p><p>
The resource names, classes, and representation types that are specified in the
<code class="function">transient\%ShellClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNtransientFor</td><td align="left">XtCTransientFor</td><td align="left">XtRWidget</td></tr></tbody></table></div><p>
The resource names, classes, and representation types that are specified in the
<code class="function">topLevelShellClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNiconName</td><td align="left">XtCIconName</td><td align="left">XtRString</td></tr><tr><td align="left">XtNiconNameEncoding</td><td align="left">XtCIconNameEncoding</td><td align="left">XtRAtom</td></tr><tr><td align="left">XtNiconic</td><td align="left">XtCIconic</td><td align="left">XtRBoolean</td></tr></tbody></table></div><p>
The resource names, classes, and representation types that are specified in the
<code class="function">application\%ShellClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNargc</td><td align="left">XtCArgc</td><td align="left">XtRInt</td></tr><tr><td align="left">XtNargv</td><td align="left">XtCArgv</td><td align="left">XtRStringArray</td></tr></tbody></table></div><p>
The resource names, classes, and representation types that are specified
in the
<code class="function">sessionShellClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNcancelCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNcloneCommand</td><td align="left">XtCCloneCommand</td><td align="left">XtRCommandArgArray</td></tr><tr><td align="left">XtNconnection</td><td align="left">XtCConnection</td><td align="left">XtRSmcConn</td></tr><tr><td align="left">XtNcurrentDirectory</td><td align="left">XtCCurrentDirectory</td><td align="left">XtRDirectoryString</td></tr><tr><td align="left">XtNdieCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNdiscardCommand</td><td align="left">XtCDiscardCommand</td><td align="left">XtRCommandArgArray</td></tr><tr><td align="left">XtNenvironment</td><td align="left">XtCEnvironment</td><td align="left">XtREnvironmentArray</td></tr><tr><td align="left">XtNerrorCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNinteractCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNjoinSession</td><td align="left">XtCJoinSession</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNprogramPath</td><td align="left">XtCProgramPath</td><td align="left">XtRString</td></tr><tr><td align="left">XtNresignCommand</td><td align="left">XtCResignCommand</td><td align="left">XtRCommandArgArray</td></tr><tr><td align="left">XtNrestartCommand</td><td align="left">XtCRestartCommand</td><td align="left">XtRCommandArgArray</td></tr><tr><td align="left">XtNrestartStyle</td><td align="left">XtCRestartStyle</td><td align="left">XtRRestartStyle</td></tr><tr><td align="left">XtNsaveCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNsaveCompleteCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNsessionID</td><td align="left">XtCSessionID</td><td align="left">XtRString</td></tr><tr><td align="left">XtNshutdownCommand</td><td align="left">XtCShutdownCommand</td><td align="left">XtRCommandArgArray</td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ShellPart_Default_Values"></a>ShellPart Default Values</h3></div></div></div><p>
The default values for fields common to all classes of public shells
(filled in by the
Shell
resource lists and the
Shell
initialize procedures) are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Default Value</th></tr></thead><tbody><tr><td align="left">geometry</td><td align="left">NULL</td></tr><tr><td align="left">create_popup_child_proc</td><td align="left">NULL</td></tr><tr><td align="left">grab_kind</td><td align="left">(none)</td></tr><tr><td align="left">spring_loaded</td><td align="left">(none)</td></tr><tr><td align="left">popped_up</td><td align="left"><code class="function">False</code></td></tr><tr><td align="left">allow_shell_resize</td><td align="left"><code class="function">False</code></td></tr><tr><td align="left">client_specified</td><td align="left">(internal)</td></tr><tr><td align="left">save_under</td><td align="left"><code class="function">True</code>
for OverrideShell and TransientShell,
<span class="strong"><strong>False</strong></span>
otherwise</td></tr><tr><td align="left">override_redirect</td><td align="left"><code class="function">True</code>
for OverrideShell,
<code class="function">False</code>
otherwise</td></tr><tr><td align="left">popup_callback</td><td align="left">NULL</td></tr><tr><td align="left">popdown_callback</td><td align="left">NULL</td></tr><tr><td align="left">visual</td><td align="left"><code class="function">CopyFromParent</code></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>geometry</em></span> field specifies the size and position
and is usually given only on a command line or in a defaults file.
If the <span class="emphasis"><em>geometry</em></span> field is non-NULL when
a widget of class WMShell
is realized, the geometry specification is parsed using
<code class="function">XWMGeometry</code>
with a default geometry
string constructed from the values of <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>,
<span class="emphasis"><em>height</em></span>, <span class="emphasis"><em>width_inc</em></span>,
and <span class="emphasis"><em>height_inc</em></span> and the size and position flags in the window manager
size hints are set. If the geometry specifies an x or y position,
then
<code class="function">USPosition</code>
is set. If the geometry specifies a width or height, then
<code class="function">USSize</code>
is set. Any fields in the geometry specification
override the corresponding values in the
Core <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, and <span class="emphasis"><em>height</em></span> fields.
If <span class="emphasis"><em>geometry</em></span> is NULL or contains only a partial specification, then the
Core <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, and <span class="emphasis"><em>height</em></span> fields are used and
<code class="function">PPosition</code>
and
<code class="function">PSize</code>
are set as appropriate.
The geometry string is not copied by any of the Intrinsics
Shell classes; a client specifying the string in an arglist
or varargs list must ensure
that the value remains valid until the shell widget is realized.
For further information on the geometry string, see
<span class="olink">????</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p><p>
The <span class="emphasis"><em>create_popup_child_proc</em></span> procedure is called by the
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
procedure and may remain NULL.
The <span class="emphasis"><em>grab_kind</em></span>, <span class="emphasis"><em>spring_loaded</em></span>,
and <span class="emphasis"><em>popped_up</em></span> fields maintain widget
state information as described under
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>,
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>,
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>,
and
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>.
The <span class="emphasis"><em>allow_shell_resize</em></span> field controls whether the widget contained
by the shell is allowed to try to resize itself.
If allow_shell_resize is
<code class="function">False</code>,
any geometry requests made by the child will always return
<code class="function">XtGeometryNo</code>
without interacting with the window manager.
Setting <span class="emphasis"><em>save_under</em></span>
<code class="function">True</code>
instructs the server to attempt
to save the contents of windows obscured by the shell when it is mapped
and to restore those contents automatically when the shell is unmapped.
It is useful for pop-up menus.
Setting <span class="emphasis"><em>override_redirect</em></span>
<code class="function">True</code>
determines
whether the window manager can intercede when the shell window
is mapped.
For further information on override_redirect,
see <span class="olink">????</span> in
<span class="olink">Xlib — C Language X Interface</span>
and
<span class="olink">????</span> and
<span class="olink">????</span> in the
<span class="olink">Inter-Client Communication Conventions Manual</span>.
The pop-up and pop-down callbacks are called during
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
and
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>.
The default value of the <span class="emphasis"><em>visual</em></span> resource is the symbolic value
<code class="function">CopyFromParent</code>.
The Intrinsics do not need to query the parent's visual type when the
default value is used; if a client using
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
to examine the visual type receives the value
<code class="function">CopyFromParent</code>,
it must then use
<code class="function">XGetWindowAttributes</code>
if it needs the actual visual type.
</p><p>
The default values for Shell fields in
WMShell
and its subclasses are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Default Value</th></tr></thead><tbody><tr><td align="left">title</td><td align="left">Icon name, if specified, otherwise the application's name</td></tr><tr><td align="left">wm_timeout</td><td align="left">Five seconds, in units of milliseconds</td></tr><tr><td align="left">wait_for_wm</td><td align="left"><code class="function">True</code></td></tr><tr><td align="left">transient</td><td align="left"><code class="function">True</code>
for TransientShell,
<code class="function">False</code>
otherwise</td></tr><tr><td align="left">urgency</td><td align="left"><code class="function">False</code></td></tr><tr><td align="left">client_leader</td><td align="left">NULL</td></tr><tr><td align="left">window_role</td><td align="left">NULL</td></tr><tr><td align="left">min_width</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">min_height</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">max_width</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">max_height</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">width_inc</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">height_inc</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">min_aspect_x</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">min_aspect_y</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">max_aspect_x</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">max_aspect_y</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">input</td><td align="left"><code class="function">False</code></td></tr><tr><td align="left">initial_state</td><td align="left">Normal</td></tr><tr><td align="left">icon_pixmap</td><td align="left">None</td></tr><tr><td align="left">icon_window</td><td align="left">None</td></tr><tr><td align="left">icon_x</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">icon_y</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">icon_mask</td><td align="left">None</td></tr><tr><td align="left">window_group</td><td align="left"><code class="function">XtUnspecifiedWindow</code></td></tr><tr><td align="left">base_width</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">base_height</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">win_gravity</td><td align="left"><code class="function">XtUnspecifiedShellInt</code></td></tr><tr><td align="left">title_encoding</td><td align="left">See text</td></tr></tbody></table></div><p>
The <span class="emphasis"><em>title</em></span> and
<span class="emphasis"><em>title_encoding</em></span> fields are stored in the
<span class="strong"><strong>WM_NAME</strong></span>
property on the shell's window by the WMShell realize procedure.
If the <span class="emphasis"><em>title_encoding</em></span> field is
<code class="function">None</code>,
the <span class="emphasis"><em>title</em></span> string is assumed to be in the encoding of the current
locale and the encoding of the
<span class="strong"><strong>WM_NAME</strong></span>
property is set to
<code class="function">XStdICCTextStyle</code>.
If a language procedure has not been set
the default value of <span class="emphasis"><em>title_encoding</em></span> is
<span class="strong"><strong>XA_STRING</strong></span>, otherwise the default value is
<code class="function">None</code>.
The <span class="emphasis"><em>wm_timeout</em></span> field specifies, in milliseconds,
the amount of time a shell is to wait for
confirmation of a geometry request to the window manager.
If none comes back within that time,
the shell assumes the window manager is not functioning properly
and sets <span class="emphasis"><em>wait_for_wm</em></span> to
<code class="function">False</code>
(later events may reset this value).
When <span class="emphasis"><em>wait_for_wm</em></span> is
<code class="function">False</code>,
the shell does not wait for a response, but relies on asynchronous
notification.
If <span class="emphasis"><em>transient</em></span> is
<code class="function">True</code>,
the
<span class="strong"><strong>WM_TRANSIENT_FOR</strong></span>
property
will be stored on the shell window with a value as specified below.
The interpretation of this property is specific to the window manager
under which the application is run; see the
<span class="olink">Inter-Client Communication Conventions Manual</span>
for more details.
</p><p>
The realize and set_values procedures of WMShell store the
<span class="strong"><strong>WM_CLIENT_LEADER</strong></span>
property on the shell window.
When <span class="emphasis"><em>client_leader</em></span> is not NULL and the client leader widget is
realized, the property will be created with the value of the window of the
client leader widget.
When <span class="emphasis"><em>client_leader</em></span> is NULL and the shell widget has a NULL parent,
the widget's window is used as the value of the
property.
When <span class="emphasis"><em>client_leader</em></span> is NULL and the shell widget has a non-NULL parent,
a search is made for the closest shell ancestor
with a non-NULL <span class="emphasis"><em>client_leader</em></span>,
and if none is found the shell ancestor with a NULL parent is the result.
If the resulting widget is realized, the property is created
with the value of the widget's window.
</p><p>
When the value of <span class="emphasis"><em>window_role</em></span> is not NULL, the
realize and set_values procedures store the
<span class="strong"><strong>WM_WINDOW_ROLE</strong></span>
property on the shell's window with the value of the resource.
</p><p>
All other resources specify fields in the window manager hints
and the window manager size hints.
The realize and set_values procedures of
WMShell
set the corresponding flag bits in the
hints if any of the fields contain nondefault values. In addition, if
a flag bit is set that refers to a field with the value
<code class="function">XtUnspecifiedShellInt</code>,
the value of the field is modified as follows:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Replacement</th></tr></thead><tbody><tr><td align="left">base_width, base_height</td><td align="left">0</td></tr><tr><td align="left">width_inc, height_inc</td><td align="left">1</td></tr><tr><td align="left">max_width, max_height</td><td align="left">32767</td></tr><tr><td align="left">min_width, min_height</td><td align="left">1</td></tr><tr><td align="left">min_aspect_x, min_aspect_y</td><td align="left">-1</td></tr><tr><td align="left">max_aspect_x, max_aspect_y</td><td align="left">-1</td></tr><tr><td align="left">icon_x, icon_y</td><td align="left">-1</td></tr><tr><td align="left">win_gravity</td><td align="left">Value returned by
<code class="function">XWMGeometry</code>
if called,
else <code class="function">NorthWestGravity</code></td></tr></tbody></table></div><p>
If the shell widget has a non-NULL parent, then the
realize and set_values procedures replace the value
<code class="function">XtUnspecifiedWindow</code>
in the <span class="emphasis"><em>window_group</em></span> field with the window id of the root widget
of the widget tree if the
root widget is realized. The symbolic constant
<code class="function">XtUnspecifiedWindowGroup</code>
may be used to indicate that the <span class="emphasis"><em>window_group</em></span> hint flag bit is not
to be set. If <span class="emphasis"><em>transient</em></span> is
<code class="function">True</code>,
the shell's class is not a subclass of
TransientShell,
and <span class="emphasis"><em>window_group</em></span> is not
<code class="function">XtUnspecifiedWindowGroup</code>,
the WMShell realize and set_values procedures then store the
<span class="strong"><strong>WM_TRANSIENT_FOR</strong></span>
property with the value of <span class="emphasis"><em>window_group</em></span>.
</p><p>
Transient
shells have the following additional resource:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Replacement</th></tr></thead><tbody><tr><td align="left">transient_for</td><td align="left">NULL</td></tr></tbody></table></div><p>
The realize and set_values procedures of
TransientShell
store the
<span class="strong"><strong>WM_TRANSIENT_FOR</strong></span>
property on the shell window if <span class="emphasis"><em>transient</em></span> is
<code class="function">True</code>.
If <span class="emphasis"><em>transient_for</em></span> is non-NULL and the widget specified by
<span class="emphasis"><em>transient_for</em></span> is realized, then its window is used as the value of the
<span class="strong"><strong>WM_TRANSIENT_FOR</strong></span>
property; otherwise, the value of <span class="emphasis"><em>window_group</em></span> is used.
</p><p>
<code class="function">TopLevel</code>
shells have the the following additional resources:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Default Value</th></tr></thead><tbody><tr><td align="left">icon_name</td><td align="left">Shell widget's name</td></tr><tr><td align="left">iconic</td><td align="left"><span class="strong"><strong>False</strong></span></td></tr><tr><td align="left">icon_name_encoding</td><td align="left">See text</td></tr></tbody></table></div><p>
The <span class="emphasis"><em>icon_name</em></span>
and <span class="emphasis"><em>icon_name_encoding</em></span> fields are stored in the
<span class="strong"><strong>WM_ICON_NAME</strong></span>
property on the shell's window by the TopLevelShell realize
procedure.
If the <span class="emphasis"><em>icon_name_encoding</em></span> field is
<code class="function">None</code>,
the <span class="emphasis"><em>icon_name</em></span> string is assumed to be in the encoding of the
current locale and the encoding of the
<span class="strong"><strong>WM_ICON_NAME</strong></span>
property is set to
<code class="function">XStdICCTextStyle</code>.
If a language procedure has not been set,
the default value of <span class="emphasis"><em>icon_name_encoding</em></span> is
<span class="strong"><strong>XA_STRING</strong></span>, otherwise the default value is
<code class="function">None</code>.
The <span class="emphasis"><em>iconic</em></span> field may be used by a client to request
that the window manager iconify or deiconify the shell; the
TopLevelShell
set_values procedure will send the appropriate
<span class="strong"><strong>WM_CHANGE_STATE</strong></span>
message (as specified by the <span class="emphasis"><em>Inter-Client Communication Conventions Manual</em></span>)
if this resource is changed from
<code class="function">False</code>
to
<code class="function">True</code>
and will call
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
specifying <span class="emphasis"><em>grab_kind</em></span> as
<code class="function">XtGrabNone</code>
if <span class="emphasis"><em>iconic</em></span> is changed from
<code class="function">True</code>
to
<code class="function">False</code>.
The XtNiconic resource is also an alternative way to set
the XtNinitialState resource
to indicate that a shell should be initially displayed as an icon; the
TopLevelShell
initialize procedure will set <span class="emphasis"><em>initial_state</em></span> to
<code class="function">IconicState</code>
if <span class="emphasis"><em>iconic</em></span> is
<code class="function">True</code>.
</p><p>
Application
shells have the following additional resources:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Default Value</th></tr></thead><tbody><tr><td align="left">argc</td><td align="left">0</td></tr><tr><td align="left">argv</td><td align="left">NULL</td></tr></tbody></table></div><p>
The <span class="emphasis"><em>argc</em></span> and <span class="emphasis"><em>argv</em></span> fields are used to initialize
the standard property
<span class="strong"><strong>WM_COMMAND</strong></span>. See the
<span class="olink">Inter-Client Communication Conventions Manual</span>
for more information.
</p><p>
The default values for the SessionShell instance fields,
which are filled in from the resource lists and by the
initialize procedure, are
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Field</th><th align="left">Default Value</th></tr></thead><tbody><tr><td align="left">cancel_callbacks</td><td align="left">NULL</td></tr><tr><td align="left">clone_command</td><td align="left">See text</td></tr><tr><td align="left">connection</td><td align="left">NULL</td></tr><tr><td align="left">current_dir</td><td align="left">NULL</td></tr><tr><td align="left">die_callbacks</td><td align="left">NULL</td></tr><tr><td align="left">discard_command</td><td align="left">NULL</td></tr><tr><td align="left">environment</td><td align="left">NULL</td></tr><tr><td align="left">error_callbacks</td><td align="left">NULL</td></tr><tr><td align="left">interact_callbacks</td><td align="left">NULL</td></tr><tr><td align="left">join_session</td><td align="left"><span class="strong"><strong>True</strong></span></td></tr><tr><td align="left">program_path</td><td align="left">NULL</td></tr><tr><td align="left">resign_command</td><td align="left">NULL</td></tr><tr><td align="left">restart_command</td><td align="left">See text</td></tr><tr><td align="left">restart_style</td><td align="left"><span class="strong"><strong>SmRestartIfRunning</strong></span></td></tr><tr><td align="left">save_callbacks</td><td align="left">NULL</td></tr><tr><td align="left">save_complete_callbacks</td><td align="left">NULL</td></tr><tr><td align="left">session_id</td><td align="left">NULL</td></tr><tr><td align="left">shutdown_command</td><td align="left">NULL</td></tr></tbody></table></div><p>
The <span class="emphasis"><em>connection</em></span> field contains the session connection object or NULL
if a session connection is not being managed by this widget.
</p><p>
The <span class="emphasis"><em>session_id</em></span> is an identification assigned to the session
participant by the session manager.
The <span class="emphasis"><em>session_id</em></span> will be passed to the session
manager as the client identifier of the previous session.
When a connection is established with the session manager,
the client id assigned by the session manager is stored
in the <span class="emphasis"><em>session_id</em></span> field.
When not NULL, the <span class="emphasis"><em>session_id</em></span> of the Session shell widget that
is at the root of the widget tree of the client leader widget will be
used to create the
<span class="strong"><strong>SM_CLIENT_ID</strong></span>
property on the client leader's window.
</p><p>
If <span class="emphasis"><em>join_session</em></span> is
<code class="function">False</code>,
the widget will not attempt to establish a
connection to the session manager at shell creation time.
See <a class="xref" href="#Joining_a_Session" title="Joining a Session">the section called “Joining a Session”</a> and
<a class="xref" href="#Resigning_from_a_Session" title="Resigning from a Session">the section called “Resigning from a Session”</a>
for more information on the functionality of this resource.
</p><p>
The <span class="emphasis"><em>restart_command</em></span>, <span class="emphasis"><em>clone_command</em></span>, <span class="emphasis"><em>discard_command</em></span>,
<span class="emphasis"><em>resign_command</em></span>, <span class="emphasis"><em>shutdown_command</em></span>, <span class="emphasis"><em>environment</em></span>,
<span class="emphasis"><em>current_dir</em></span>, <span class="emphasis"><em>program_path</em></span>, and
<span class="emphasis"><em>restart_style</em></span> fields contain standard session properties.
</p><p>
When a session connection is established or newly managed by the shell,
the shell initialize and set_values methods check the values of the
<span class="emphasis"><em>restart_command</em></span>,
<span class="emphasis"><em>clone_command</em></span>,
and <span class="emphasis"><em>program_path</em></span>
resources. At that time, if <span class="emphasis"><em>restart_command</em></span> is NULL, the value
of the <span class="emphasis"><em>argv</em></span> resource will be copied to <span class="emphasis"><em>restart_command</em></span>.
Whether or not <span class="emphasis"><em>restart_command</em></span> was NULL,
if "<span class="emphasis"><em>-xtsessionID</em></span>" "<span class="emphasis"><em><session id></em></span>" does not
already appear in the <span class="emphasis"><em>restart_command</em></span>, it will be added by the
initialize and set_values methods at the beginning of the command arguments;
if the "<span class="emphasis"><em>-xtsessionID</em></span>" argument already appears with an incorrect
<span class="emphasis"><em>session id</em></span> in the following argument, that argument
will be replaced with the current <span class="emphasis"><em>session id</em></span>.
</p><p>
After this, the shell initialize and set_values procedures check the
<span class="emphasis"><em>clone_command</em></span>. If <span class="emphasis"><em>clone_command</em></span> is NULL,
<span class="emphasis"><em>restart_command</em></span> will be copied to <span class="emphasis"><em>clone_command</em></span>,
except the "<span class="emphasis"><em>-xtsessionID</em></span>" and following argument will not be copied.
</p><p>
Finally, the shell initialize and set_values procedures check the
<span class="emphasis"><em>program_path</em></span>. If <span class="emphasis"><em>program_path</em></span> is NULL, the
first element of <span class="emphasis"><em>restart_command</em></span> is copied to <span class="emphasis"><em>program_path</em></span>.
</p><p>
The possible values of <span class="emphasis"><em>restart_style</em></span> are
<code class="function">SmRestartIfRunning</code>,
<code class="function">SmRestartAnyway</code>,
<code class="function">SmRestartImmediately</code>,
and
<code class="function">SmRestartNever</code>.
A resource converter is registered for this resource;
for the strings that it recognizes,
see <a class="xref" href="#Predefined_Resource_Converters" title="Predefined Resource Converters">the section called “Predefined Resource Converters”</a>.
</p><p>
The resource type EnvironmentArray is a NULL-terminated array of
pointers to strings;
each string has the format "name=value".
The `=' character may not appear in the name,
and the string is terminated by a null character.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Session_Participation"></a>Session Participation</h2></div></div></div><p>
Applications can participate in a user's session, exchanging messages
with the session manager as described in the
<span class="emphasis"><em>X Session Management Protocol</em></span> and the
<span class="emphasis"><em>X Session Management Library</em></span>.
</p><p>
When a widget of
<code class="function">sessionShellWidgetClass</code>
or a subclass is created, the widget provides support for the application
as a session participant and continues to provide support until the
widget is destroyed.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Joining_a_Session"></a>Joining a Session</h3></div></div></div><p>
When a Session shell is created,
if <span class="emphasis"><em>connection</em></span> is NULL,
and if <span class="emphasis"><em>join_session</em></span> is
<code class="function">True</code>,
and if <span class="emphasis"><em>argv</em></span> or <span class="emphasis"><em>restart_command</em></span> is not NULL,
and if in POSIX environments the
<span class="strong"><strong>SESSION_MANAGER</strong></span>
environment variable is defined,
the shell will attempt to establish a new connection with the session manager.
</p><p>
To transfer management of an existing session connection from an
application to the shell at widget creation time, pass the existing
session connection ID as the <span class="emphasis"><em>connection</em></span> resource value
when creating the Session shell,
and if the other creation-time conditions on session participation are met,
the widget will maintain the connection with the session manager.
The application must ensure that only one
Session shell manages the connection.
</p><p>
In the Session shell set_values procedure,
if <span class="emphasis"><em>join_session</em></span> changes from
<code class="function">False</code>
to
<code class="function">True</code>
and <span class="emphasis"><em>connection</em></span> is NULL and when in POSIX environments the
<span class="strong"><strong>SESSION_MANAGER</strong></span>
environment variable is defined,
the shell will attempt to open a connection to the session manager.
If <span class="emphasis"><em>connection</em></span> changes from NULL to non-NULL, the
Session shell
will take over management of that session connection and will set
<span class="emphasis"><em>join_session</em></span> to
<code class="function">True</code>.
If <span class="emphasis"><em>join_session</em></span> changes from
<code class="function">False</code>
to
<code class="function">True</code>
and <span class="emphasis"><em>connection</em></span> is not NULL, the
Session shell will take over management of the session connection.
</p><p>
When a successful connection has been established, <span class="emphasis"><em>connection</em></span>
contains the session connection ID for the session participant.
When the shell begins to manage the connection, it will call
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>
to register the handler which watches for protocol messages
from the session manager.
When the attempt to connect fails, a warning message is issued
and <span class="emphasis"><em>connection</em></span> is set to NULL.
</p><p>
While the connection is being managed, if a
<code class="function">SaveYourself</code>,
<code class="function">SaveYourselfPhase2</code>,
<code class="function">Interact</code>,
<code class="function">ShutdownCancelled</code>,
<code class="function">SaveComplete</code>,
or
<code class="function">Die</code>
message is received from the session manager, the Session shell will
call out to application callback procedures registered
on the respective callback list of the Session shell and will
send
<code class="function">SaveYourselfPhase2Request</code>,
<code class="function">InteractRequest</code>,
<code class="function">InteractDone</code>,
<code class="function">SaveYourselfDone</code>,
and
<code class="function">ConnectionClosed</code>
messages as appropriate.
Initially, all of the client's session properties are undefined.
When any of the session property resource values are defined or change,
the Session shell initialize and set_values procedures
will update the client's session property value by a
<code class="function">SetProperties</code>
or a
<code class="function">DeleteProperties</code>
message, as appropriate.
The session ProcessID and UserID properties are always set by the shell
when it is possible to determine the value of these properties.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Saving_Application_State"></a>Saving Application State</h3></div></div></div><p>
The session manager instigates an application checkpoint by sending a
<code class="function">SaveYourself</code>
request.
Applications are responsible for saving their state in response to the
request.
</p><p>
When the
<code class="function">SaveYourself</code>
request arrives, the procedures registered on the
Session shell's save callback list are called.
If the application does not register any save callback procedures on
the save callback list, the shell will report to the session manager
that the application failed to save its state.
Each procedure on the save callback list receives a token
in the <span class="emphasis"><em>call_data</em></span> parameter.
</p><p>
The checkpoint token in the <span class="emphasis"><em>call_data</em></span> parameter is of type
<code class="function">XtCheckpointToken</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
int save_type;<br />
int interact_style;<br />
Boolean shutdown;<br />
Boolean fast;<br />
Boolean cancel_shutdown<br />
int phase;<br />
int interact_dialog_type; /* return */<br />
Boolean request_cancel; /* return */<br />
Boolean request_next_phase; /* return */<br />
Boolean save_success; /* return */<br />
} XtCheckpointTokenRec, *XtCheckpointToken;<br />
</p></div><p>
The <span class="emphasis"><em>save_type</em></span>, <span class="emphasis"><em>interact_style</em></span>, <span class="emphasis"><em>shutdown</em></span>, and <span class="emphasis"><em>fast</em></span>
fields of the token contain the parameters of the
<code class="function">SaveYourself</code>
message.
The possible values of <span class="emphasis"><em>save_type</em></span> are
<code class="function">SmSaveLocal</code>,
<code class="function">SmSaveGlobal</code>,
and
<code class="function">SmSaveBoth</code>;
these indicate the type of information to be saved.
The possible values of <span class="emphasis"><em>interact_style</em></span> are
<code class="function">SmInteractStyleNone</code>,
<code class="function">SmInteractStyleErrors</code>,
and
<code class="function">SmInteractStyleAny</code>;
these indicate whether user interaction would be permitted
and, if so, what kind of interaction.
If <span class="emphasis"><em>shutdown</em></span> is
<code class="function">True</code>,
the checkpoint is being performed in preparation for the end of the session.
If <span class="emphasis"><em>fast</em></span> is
<code class="function">True</code>,
the client should perform the checkpoint as quickly as possible.
If <span class="emphasis"><em>cancel_shutdown</em></span> is
<code class="function">True</code>,
a
<code class="function">ShutdownCancelled</code>
message has been received for the current save operation.
(See <a class="xref" href="#Resigning_from_a_Session" title="Resigning from a Session">the section called “Resigning from a Session”</a>.)
The <span class="emphasis"><em>phase</em></span> is used by manager clients, such as a window manager,
to distinguish between the first and second phase of a save operation.
The <span class="emphasis"><em>phase</em></span> will be either 1 or 2.
The remaining fields in the checkpoint token structure are provided for
the application to communicate with the shell.
</p><p>
Upon entry to the first application save callback procedure, the return
fields in the token have the following initial values:
<span class="emphasis"><em>interact_dialog_type</em></span> is
<code class="function">SmDialogNormal</code>;
<span class="emphasis"><em>request_cancel</em></span> is
<code class="function">False</code>;
<span class="emphasis"><em>request_next_phase</em></span> is
<code class="function">False</code>;
and <span class="emphasis"><em>save_success</em></span> is
<code class="function">True</code>.
When a token is returned with any of the four return fields containing
a noninitial value, and when the field is applicable, subsequent tokens
passed to the application during the current save operation
will always contain the noninitial value.
</p><p>
The purpose of the token's <span class="emphasis"><em>save_success</em></span> field is to
indicate the outcome of the entire operation to the
session manager and ultimately, to the user.
Returning
<code class="function">False</code>
indicates some portion of the application state
could not be successfully saved. If any token is returned
to the shell with <span class="emphasis"><em>save_success</em></span>
<code class="function">False</code>,
tokens subsequently received
by the application for the current save operation will show
<span class="emphasis"><em>save_success</em></span> as
<code class="function">False</code>.
When the shell sends the final status of the checkpoint to the
session manager, it will indicate failure to save application state
if any token was returned with <span class="emphasis"><em>save_success</em></span>
<code class="function">False</code>.
</p><p>
Session participants that manage and save the state of other clients
should structure their save or interact callbacks to
set <span class="emphasis"><em>request_next_phase</em></span> to
<code class="function">True</code>
when phase is 1, which will cause the shell to send the
<code class="function">SaveYourselfPhase2Request</code>
when the first phase is complete. When the
<code class="function">SaveYourselfPhase2</code>
message is received, the shell will invoke the save callbacks a
second time with <span class="emphasis"><em>phase</em></span> equal to 2.
Manager clients should save the state of other clients
when the callbacks are invoked the second time and <span class="emphasis"><em>phase</em></span> equal to 2.
</p><p>
The application may request additional tokens while a checkpoint is under way,
and these additional tokens must be returned by an explicit call.
</p><p>
To request an additional token for a save callback response that has a
deferred outcome, use
<a class="xref" href="#XtSessionGetToken"><code class="function">XtSessionGetToken</code></a>.
</p><div class="funcsynopsis"><a id="XtSessionGetToken"></a><p><code class="funcdef">XtCheckpointToken <strong class="fsfunc">XtSessionGetToken</strong>(</code>Widget <var class="pdparam">widget</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the Session shell widget which manages session participation.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtSessionGetToken"><code class="function">XtSessionGetToken</code></a>
function will return NULL if no checkpoint operation is currently under way.
</p><p>
To indicate the completion of checkpoint processing including user
interaction, the application must signal the Session shell
by returning all tokens.
(See <a class="xref" href="#Interacting_with_the_User_during_a_Checkpoint" title="Interacting with the User during a Checkpoint">the section called “Interacting with the User during a Checkpoint”</a> and
<a class="xref" href="#Completing_a_Save" title="Completing a Save">the section called “Completing a Save”</a>).
To return a token, use
<a class="xref" href="#XtSessionReturnToken"><code class="function">XtSessionReturnToken</code></a>.
</p><div class="funcsynopsis"><a id="XtSessionReturnToken"></a><p><code class="funcdef">void <strong class="fsfunc">XtSessionReturnToken</strong>(</code>XtCheckpointToken <var class="pdparam">token</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>token</em></span>
</span></p></td><td><p>
Specifies a token that was received as the <span class="emphasis"><em>call_data</em></span> by a procedure
on the interact callback list or a token that was received by a call to
<a class="xref" href="#XtSessionGetToken"><code class="function">XtSessionGetToken</code></a>.
</p></td></tr></tbody></table></div><p>
Tokens passed as <span class="emphasis"><em>call_data</em></span> to save callbacks are implicitly
returned when the save callback procedure returns.
A save callback procedure should not call
<a class="xref" href="#XtSessionReturnToken"><code class="function">XtSessionReturnToken</code></a>
on the token passed in its <span class="emphasis"><em>call_data</em></span>.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Requesting_Interaction"></a>Requesting Interaction</h4></div></div></div><p>
When the token <span class="emphasis"><em>interact_style</em></span> allows user interaction,
the application may
interact with the user during the checkpoint, but must wait for permission
to interact.
Applications request permission to interact with the user during the
checkpointing operation by registering a procedure on the Session
shell's interact callback list. When all save callback procedures have
returned, and each time a token that was granted by a call to
<a class="xref" href="#XtSessionGetToken"><code class="function">XtSessionGetToken</code></a>
is returned, the Session shell examines the interact callback list.
If interaction is permitted and the interact callback list is not empty,
the shell will send an
<code class="function">InteractRequest</code>
to the session manager when an interact request is not already outstanding
for the application.
</p><p>
The type of interaction dialog that will be requested is specified by
the <span class="emphasis"><em>interact_dialog_type</em></span> field in the checkpoint token.
The possible values for <span class="emphasis"><em>interact_dialog_type</em></span> are
<code class="function">SmDialogError</code>
and
<code class="function">SmDialogNormal</code>.
If a token is returned with <span class="emphasis"><em>interact_dialog_type</em></span> containing
<code class="function">SmDialogError</code>,
the interact request and any subsequent interact requests will be for
an error dialog; otherwise, the request will be for a normal dialog with
the user.
</p><p>
When a token is returned with <span class="emphasis"><em>save_success</em></span>
<code class="function">False</code>
or <span class="emphasis"><em>interact_dialog_type</em></span>
<code class="function">SmDialogError</code>,
tokens subsequently passed to callbacks during the same active
<code class="function">SaveYourself</code>
response will reflect these changed values, indicating that
an error condition has occurred during the checkpoint.
</p><p>
The <span class="emphasis"><em>request_cancel</em></span> field is a return value for interact callbacks only.
Upon return from a procedure on the save callback list, the value
of the token's <span class="emphasis"><em>request_cancel</em></span> field is not examined by the shell.
This is also true of tokens received through a call to
<a class="xref" href="#XtSessionGetToken"><code class="function">XtSessionGetToken</code></a>.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Interacting_with_the_User_during_a_Checkpoint"></a>Interacting with the User during a Checkpoint</h4></div></div></div><p>
When the session manager grants the application's request for user interaction,
the Session shell receives an
<code class="function">Interact</code>
message.
The procedures registered on the interact callback list are executed,
but not as if executing a typical callback list.
These procedures are individually executed in
sequence, with a checkpoint token functioning as the sequencing mechanism.
Each step in the sequence begins by removing a procedure
from the interact callback list
and executing it with a token passed in the <span class="emphasis"><em>call_data</em></span>.
The interact callback will typically pop up a dialog box and return.
When the user interaction and associated application checkpointing has
completed, the application must return the token by calling
<a class="xref" href="#XtSessionReturnToken"><code class="function">XtSessionReturnToken</code></a>.
Returning the token completes the current step and triggers the next step
in the sequence.
</p><p>
During interaction the client may request cancellation of a shutdown.
When a token passed as <span class="emphasis"><em>call_data</em></span> to an interact procedure is returned,
if <span class="emphasis"><em>shutdown</em></span> is
<code class="function">True</code>
and <span class="emphasis"><em>cancel_shutdown</em></span> is
<code class="function">False</code>,
<span class="emphasis"><em>request_cancel</em></span> indicates whether the
application requests that the pending shutdown be cancelled.
If <span class="emphasis"><em>request_cancel</em></span> is
<code class="function">True</code>,
the field will also be
<code class="function">True</code>
in any tokens subsequently granted during the checkpoint operation.
When a token is returned requesting cancellation of
the session shutdown, pending interact procedures will still be
called by the Session shell.
When all interact procedures have been removed from the interact callback
list, executed, and the final interact token returned to the shell, an
<code class="function">InteractDone</code>
message is sent to the session manager, indicating whether
a pending session shutdown is requested to be cancelled.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Responding_to_a_Shutdown_Cancellation"></a>Responding to a Shutdown Cancellation</h4></div></div></div><p>
Callbacks registered on the cancel callback list are invoked when the
Session shell processes a
<code class="function">ShutdownCancelled</code>
message from the session manager. This may occur during the
processing of save callbacks, while waiting for interact permission,
during user interaction, or after the save operation is complete and
the application is expecting a
<code class="function">SaveComplete</code>
or a
<code class="function">Die</code>
message.
The <span class="emphasis"><em>call_data</em></span> for these callbacks is NULL.
</p><p>
When the shell notices that a pending shutdown has been cancelled,
the token <span class="emphasis"><em>cancel_shutdown</em></span> field will be
<code class="function">True</code>
in tokens subsequently given to the application.
</p><p>
Receiving notice of a shutdown cancellation does not cancel the
pending execution of save callbacks or interact callbacks.
After the cancel callbacks execute, if <span class="emphasis"><em>interact_style</em></span> is not
<code class="function">SmInteractStyleNone</code>
and the interact list is not empty,
the procedures on the interact callback list will be executed
and passed a token with <span class="emphasis"><em>interact_style</em></span>
<code class="function">SmInteractStyleNone</code>.
The application should not interact with the user, and the Session shell
will not send an
<code class="function">InteractDone</code>
message.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Completing_a_Save"></a>Completing a Save</h4></div></div></div><p>
When there is no user interaction, the shell regards the application
as having finished saving state when all callback procedures
on the save callback list have returned, and any additional tokens
passed out by
<a class="xref" href="#XtSessionGetToken"><code class="function">XtSessionGetToken</code></a>
have been returned by corresponding calls to
<a class="xref" href="#XtSessionReturnToken"><code class="function">XtSessionReturnToken</code></a>.
If the save operation involved user interaction,
the above completion conditions apply, and in addition, all requests for
interaction have been granted or cancelled,
and all tokens passed to interact callbacks have been returned
through calls to
<a class="xref" href="#XtSessionReturnToken"><code class="function">XtSessionReturnToken</code></a>.
If the save operation involved a manager client that requested the
second phase, the above conditions apply to both the first and second
phase of the save operation.
</p><p>
When the application has finished saving state,
the Session shell will report the result to the session manager by
sending the
<code class="function">SaveYourselfDone</code>
message.
If the session is continuing, the shell will receive the
<code class="function">SaveComplete</code>
message when all applications have completed saving state.
This message indicates that applications may again allow changes
to their state. The shell will execute the save_complete callbacks.
The <span class="emphasis"><em>call_data</em></span> for these callbacks is NULL.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Responding_to_a_Shutdown"></a>Responding to a Shutdown</h3></div></div></div><p>
Callbacks registered on the die callback list are invoked when the
session manager sends a
<code class="function">Die</code>
message.
The callbacks on this list should do whatever is appropriate to quit
the application.
Before executing procedures on the die callback list,
the Session shell will close the connection to the session manager
and will remove the handler that watches for protocol messages.
The <span class="emphasis"><em>call_data</em></span> for these callbacks is NULL.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Resigning_from_a_Session"></a>Resigning from a Session</h3></div></div></div><p>
When the Session shell widget is destroyed, the destroy method will
close the connection to the session manager by sending a
<code class="function">ConnectionClosed</code>
protocol message and will remove the input callback
that was watching for session protocol messages.
</p><p>
When
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
is used to set <span class="emphasis"><em>join_session</em></span> to
<code class="function">False</code>,
the set_values method of the Session shell will close the
connection to the session manager if one exists by sending a
<code class="function">ConnectionClosed</code>
message, and <span class="emphasis"><em>connection</em></span> will be set to NULL.
</p><p>
Applications that exit in response to user actions and that do not
wait for phase 2 destroy to complete on
the Session shell should set <span class="emphasis"><em>join_session</em></span> to
<code class="function">False</code>
before exiting.
</p><p>
When
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
is used to set <span class="emphasis"><em>connection</em></span> to NULL,
the Session shell will stop managing the connection, if one exists.
However, that session connection will not be closed.
</p><p>
Applications that wish to ensure continuation of a session connection
beyond the destruction of the shell should first retrieve the
<span class="emphasis"><em>connection</em></span> resource value,
then set the <span class="emphasis"><em>connection</em></span> resource to NULL,
and then they may safely destroy the widget without losing control
of the session connection.
</p><p>
The error callback list will be called if an unrecoverable
communications error occurs while the shell is managing the connection.
The shell will close the connection, set <span class="emphasis"><em>connection</em></span> to NULL,
remove the input callback, and
call the procedures registered on the error callback list.
The <span class="emphasis"><em>call_data</em></span> for these callbacks is NULL.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Pop_Up_Widgets"></a>Chapter 5. Pop-Up Widgets</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Pop_Up_Widget_Types">Pop-Up Widget Types</a></span></dt><dt><span class="sect1"><a href="#Creating_a_Pop_Up_Shell">Creating a Pop-Up Shell</a></span></dt><dt><span class="sect1"><a href="#Creating_Pop_Up_Children">Creating Pop-Up Children</a></span></dt><dt><span class="sect1"><a href="#Mapping_a_Pop_Up_Widget">Mapping a Pop-Up Widget</a></span></dt><dt><span class="sect1"><a href="#Unmapping_a_Pop_Up_Widget">Unmapping a Pop-Up Widget</a></span></dt></dl></div><p>
Pop-up widgets are used to create windows outside of the
window hierarchy defined by the widget tree.
Each pop-up child has a window that is a descendant of the root window,
so that the pop-up window is not clipped by the pop-up widget's parent window.
Therefore, pop-ups are created and attached differently to their widget parent
than normal widget children.
</p><p>
A parent of a pop-up widget does not actively manage its pop-up children;
in fact, it usually does not operate upon them in any way.
The <span class="emphasis"><em>popup_list</em></span> field in the
<code class="function">CorePart</code>
structure contains the list of its pop-up children.
This pop-up list exists mainly to provide the proper place in the widget
hierarchy for the pop-up to get resources and to provide a place for
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
to look for all extant children.
</p><p>
A
composite
widget can have both normal and pop-up children.
A pop-up can be popped up from almost anywhere, not just by its parent.
The term <span class="emphasis"><em>child</em></span> always refers to a normal, geometry-managed widget
on the composite widget's list of children, and the term
<span class="emphasis"><em>pop-up child</em></span> always refers to a
widget on the pop-up list.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Pop_Up_Widget_Types"></a>Pop-Up Widget Types</h2></div></div></div><p>
There are three kinds of pop-up widgets:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Modeless pop-ups
</p><p>
A modeless pop-up (for example, a dialog box that does not prevent
continued interaction with the rest of the application)
can usually be manipulated by the window manager
and looks like any other application window from the
user's point of view.
The application main window itself is a special case of a modeless pop-up.
</p></li><li class="listitem"><p>
Modal pop-ups
</p><p>
A modal pop-up (for example, a dialog box that requires user input to
continue)
can sometimes be manipulated by the window manager,
and except for events that occur in the dialog box,
it disables user-event distribution to the rest of the application.
</p></li><li class="listitem"><p>
Spring-loaded pop-ups
</p><p>
A spring-loaded pop-up (for example, a menu)
can seldom be manipulated by the window manager,
and except for events that occur in the pop-up or its descendants,
it disables user-event distribution to all other applications.
</p></li></ul></div><p>
Modal pop-ups and spring-loaded pop-ups are very similar and should be coded as
if they were the same.
In fact, the same widget (for example, a ButtonBox or Menu widget) can be used both
as a modal pop-up and as a spring-loaded pop-up within the same application.
The main difference is that spring-loaded pop-ups are brought up
with the pointer and, because of the grab that the pointer button causes,
require different processing by the Intrinsics.
Furthermore, all user input remap events occurring outside the spring-loaded
pop-up (e.g., in a descendant) are also delivered to the spring-loaded
pop-up after they have been dispatched to the appropriate descendant, so
that, for example, button-up can take down a spring-loaded pop-up no
matter where the
button-up occurs.
</p><p>
Any kind of pop-up, in turn, can pop up other widgets.
Modal and spring-loaded pop-ups can constrain user events to
the most recent such pop-up or allow user events to be dispatched
to any of the modal or spring-loaded pop-ups
currently mapped.
</p><p>
Regardless of their type,
all pop-up widget classes are responsible for communicating with the
X window manager and therefore are subclasses of
one of the
Shell
widget classes.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Creating_a_Pop_Up_Shell"></a>Creating a Pop-Up Shell</h2></div></div></div><p>
For a widget to be popped up,
it must be the child of a pop-up shell widget.
None of the Intrinsics-supplied shells will
simultaneously manage more than one child.
Both the shell and child taken together are referred to as the pop-up.
When you need to use a pop-up,
you always refer to the pop-up by the pop-up shell,
not the child.
</p><p>
To create a pop-up shell, use
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>.
</p><div class="funcsynopsis"><a id="XtCreatePopupShell"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtCreatePopupShell</strong>(</code>String <var class="pdparam">name</var>, WidgetClass <var class="pdparam">widget_class</var>, Widget <var class="pdparam">parent</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the instance name for the created shell widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class pointer for the created shell widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>parent</em></span>
</span></p></td><td><p>
Specifies the parent widget. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any other resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>
function ensures that the specified class is a subclass of
Shell
and, rather than using insert_child to attach the widget to the parent's
<span class="emphasis"><em>children</em></span> list,
attaches the shell to the parent's <span class="emphasis"><em>popup_list</em></span> directly.
</p><p>
The screen resource for this widget is determined by first scanning
<span class="emphasis"><em>args</em></span> for the XtNscreen argument. If no XtNscreen argument is
found, the resource database associated with the parent's screen
is queried for the resource <span class="emphasis"><em>name</em></span>.screen, class
<span class="emphasis"><em>Class</em></span>.Screen where <span class="emphasis"><em>Class</em></span> is the <span class="emphasis"><em>class_name</em></span>
field from the
<code class="function">CoreClassPart</code>
of the specified <span class="emphasis"><em>widget_class</em></span>.
If this query fails, the parent's screen is used.
Once the screen is determined,
the resource database associated with that screen is used to retrieve
all remaining resources for the widget not specified in
<span class="emphasis"><em>args</em></span>.
</p><p>
A spring-loaded pop-up invoked from a translation table via
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
must already exist
at the time that the translation is invoked,
so the translation manager can find the shell by name.
Pop-ups invoked in other ways can be created when
the pop-up actually is needed.
This delayed creation of the shell is particularly useful when you pop up
an unspecified number of pop-ups.
You can look to see if an appropriate unused shell (that is, not
currently popped up) exists and create a new shell if needed.
</p><p>
To create a pop-up shell using varargs lists, use
<a class="xref" href="#XtVaCreatePopupShell"><code class="function">XtVaCreatePopupShell</code></a>.
</p><div class="funcsynopsis"><a id="XtVaCreatePopupShell"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtVaCreatePopupShell</strong>(</code>String <var class="pdparam">name</var>, WidgetClass <var class="pdparam">widget_class</var>, Widget <var class="pdparam">parent</var>, <var class="pdparam">...</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the instance name for the created shell widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class pointer for the created shell widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>parent</em></span>
</span></p></td><td><p>
Specifies the parent widget. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">...</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaCreatePopupShell"><code class="function">XtVaCreatePopupShell</code></a>
is identical in function to
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>
with <span class="emphasis"><em>the</em></span> args and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list as
described in Section 2.5.1.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Creating_Pop_Up_Children"></a>Creating Pop-Up Children</h2></div></div></div><p>
Once a pop-up shell is created,
the single child of the pop-up shell can be created
either statically or dynamically.
</p><p>
At startup,
an application can create the child of the pop-up shell,
which is appropriate for pop-up children composed of a fixed set
of widgets.
The application can change the state of the subparts of
the pop-up child as the application state changes.
For example, if an application creates a static menu,
it can call
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
(or, in general,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>)
on any of the buttons that make up the menu.
Creating the pop-up child early means that pop-up time is minimized,
especially if the application calls
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
on the pop-up shell at startup.
When the menu is needed,
all the widgets that make up the menu already exist and need only be mapped.
The menu should pop up as quickly as the X server can respond.
</p><p>
Alternatively,
an application can postpone the creation of the child until it is needed,
which minimizes application startup time and allows the pop-up child to
reconfigure itself each time it is popped up.
In this case,
the pop-up child creation routine might poll the application
to find out if it should change the sensitivity of any of its subparts.
</p><p>
Pop-up child creation does not map the pop-up,
even if you create the child and call
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
on the pop-up shell.
</p><p>
All shells have pop-up and pop-down callbacks,
which provide the opportunity either to make last-minute changes to a
pop-up child before it is popped up or to change it after it is popped down.
Note that excessive use of pop-up callbacks can make
popping up occur more slowly.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Mapping_a_Pop_Up_Widget"></a>Mapping a Pop-Up Widget</h2></div></div></div><p>
Pop-ups can be popped up through several mechanisms:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A call to
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
or
<a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>.
</p></li><li class="listitem"><p>
One of the supplied callback procedures
<a class="xref" href="#XtCallbackNone"><code class="function">XtCallbackNone</code></a>,
<a class="xref" href="#XtCallbackNonexclusive"><code class="function">XtCallbackNonexclusive</code></a>,
or
<a class="xref" href="#XtCallbackExclusive"><code class="function">XtCallbackExclusive</code></a>.
</p></li><li class="listitem"><p>
The standard translation action
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>.
</p></li></ul></div><p>
Some of these routines take an argument of type
<code class="function">XtGrabKind</code>,
which is defined as
</p><div class="literallayout"><p><br />
typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind;<br />
</p></div><p>
The create_popup_child_proc procedure pointer
in the shell widget instance record is of type
<a class="xref" href="#XtCreatePopupChildProc"><code class="function">*XtCreatePopupChildProc</code></a>.
</p><div class="funcsynopsis"><a id="XtCreatePopupChildProc"></a><p><code class="funcdef">void <strong class="fsfunc">*XtCreatePopupChildProc</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the shell widget being popped up.
</p></td></tr></tbody></table></div><p>
To map a pop-up from within an application, use
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>.
</p><div class="funcsynopsis"><a id="XtPopup"></a><p><code class="funcdef">void <strong class="fsfunc">XtPopup</strong>(</code>Widget <var class="pdparam">popup_shell</var>, XtGrabKind <var class="pdparam">grab_kind</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>popup_shell</em></span>
</span></p></td><td><p>
Specifies the shell widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>grab_kind</em></span>
</span></p></td><td><p>
Specifies the way in which user events should be constrained.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
function performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Calls
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>
to ensure <span class="emphasis"><em>popup_shell</em></span>'s class is a subclass of
<code class="function">shellWidgetClass</code>.
</p></li><li class="listitem"><p>
Raises the window and returns if the shell's <span class="emphasis"><em>popped_up</em></span> field is already
<code class="function">True</code>.
</p></li><li class="listitem"><p>
Calls the callback procedures on the shell's <span class="emphasis"><em>popup_callback</em></span> list,
specifying a pointer to the value of <span class="emphasis"><em>grab_kind</em></span> as the <span class="emphasis"><em>call_data</em></span>
argument.
</p></li><li class="listitem"><p>
Sets the shell <span class="emphasis"><em>popped_up</em></span> field to
<code class="function">True</code>,
the shell <span class="emphasis"><em>spring_loaded</em></span> field to
<code class="function">False</code>,
and the shell <span class="emphasis"><em>grab_kind</em></span> field from <span class="emphasis"><em>grab_kind</em></span>.
</p></li><li class="listitem"><p>
If the shell's <span class="emphasis"><em>create_popup_child_proc</em></span> field is non-NULL,
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
calls it with <span class="emphasis"><em>popup_shell</em></span> as the parameter.
</p></li><li class="listitem"><p>
If <span class="emphasis"><em>grab_kind</em></span> is either
<code class="function">XtGrabNonexclusive</code>
or
<code class="function">XtGrabExclusive</code>,
it calls
</p><div class="literallayout"><p><br />
XtAddGrab(<span class="emphasis"><em>popup_shell</em></span>, (<span class="emphasis"><em>grab_kind</em></span> == XtGrabExclusive), False)<br />
</p></div></li><li class="listitem"><p>
Calls
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
with <span class="emphasis"><em>popup_shell</em></span> specified.
</p></li><li class="listitem"><p>
Calls
<code class="function">XMapRaised</code>
with the window of <span class="emphasis"><em>popup_shell</em></span>.
</p></li></ul></div><p>
To map a spring-loaded pop-up from within an application, use
<a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>.
</p><div class="funcsynopsis"><a id="XtPopupSpringLoaded"></a><p><code class="funcdef">void <strong class="fsfunc">XtPopupSpringLoaded</strong>(</code>Widget <var class="pdparam">popup_shell</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>popup_shell</em></span>
</span></p></td><td><p>
Specifies the shell widget to be popped up.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>
function performs exactly as
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
except that it sets the shell <span class="emphasis"><em>spring_loaded</em></span> field to
<code class="function">True</code>
and always calls
<a class="xref" href="#XtAddGrab"><code class="function">XtAddGrab</code></a>
with <span class="emphasis"><em>exclusive</em></span>
<code class="function">True</code>
and <span class="emphasis"><em>spring-loaded</em></span>
<code class="function">True</code>.
</p><p>
To map a pop-up from a given widget's callback list,
you also can register one of the
<a class="xref" href="#XtCallbackNone"><code class="function">XtCallbackNone</code></a>,
<a class="xref" href="#XtCallbackNonexclusive"><code class="function">XtCallbackNonexclusive</code></a>,
or
<a class="xref" href="#XtCallbackExclusive"><code class="function">XtCallbackExclusive</code></a>
convenience routines as callbacks, using the pop-up shell widget as the
client data.
</p><div class="funcsynopsis"><a id="XtCallbackNone"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallbackNone</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the pop-up shell.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Specifies the callback data argument,
which is not used by this procedure.
</p></td></tr></tbody></table></div><div class="funcsynopsis"><a id="XtCallbackNonexclusive"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallbackNonexclusive</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the pop-up shell.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Specifies the callback data argument,
which is not used by this procedure.
</p></td></tr></tbody></table></div><div class="funcsynopsis"><a id="XtCallbackExclusive"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallbackExclusive</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the pop-up shell.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Specifies the callback data argument,
which is not used by this procedure.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCallbackNone"><code class="function">XtCallbackNone</code></a>,
<a class="xref" href="#XtCallbackNonexclusive"><code class="function">XtCallbackNonexclusive</code></a>,
and
<a class="xref" href="#XtCallbackExclusive"><code class="function">XtCallbackExclusive</code></a>
functions call
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
with the shell specified by the <span class="emphasis"><em>client_data</em></span> argument
and <span class="emphasis"><em>grab_kind</em></span> set as the name specifies.
<a class="xref" href="#XtCallbackNone"><code class="function">XtCallbackNone</code></a>,
<a class="xref" href="#XtCallbackNonexclusive"><code class="function">XtCallbackNonexclusive</code></a>,
and
<a class="xref" href="#XtCallbackExclusive"><code class="function">XtCallbackExclusive</code></a>
specify
<code class="function">XtGrabNone</code>,
<code class="function">XtGrabNonexclusive</code>,
and
<code class="function">XtGrabExclusive</code>,
respectively.
Each function then sets the widget that executed the callback list
to be insensitive by calling
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>.
Using these functions in callbacks is not required.
In particular,
an application must provide customized code for
callbacks that create pop-up shells dynamically or that must do more than
desensitizing the button.
</p><p>
Within a translation table,
to pop up a menu when a key or pointer button is pressed or when the pointer
is moved into a widget, use
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>,
or its synonym,
<code class="function">MenuPopup</code>.
From a translation writer's point of view,
the definition for this translation action is
</p><div class="funcsynopsis"><a id="XtMenuPopup"></a><p><code class="funcdef">void <strong class="fsfunc">XtMenuPopup</strong>(</code>String <var class="pdparam">shell_name</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>shell_name</em></span>
</span></p></td><td><p>
Specifies the name of the shell widget to pop up.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
is known to the translation manager,
which registers the corresponding built-in action procedure
<code class="function">XtMenuPopupAction</code>
using
<a class="xref" href="#XtRegisterGrabAction"><code class="function">XtRegisterGrabAction</code></a>
specifying <span class="emphasis"><em>owner_events</em></span>
<code class="function">True</code>,
<span class="emphasis"><em>event_mask</em></span>
<code class="function">ButtonPressMask</code>
<code class="function">|</code>
<code class="function">ButtonReleaseMask</code>,
and <span class="emphasis"><em>pointer_mode</em></span> and <span class="emphasis"><em>keyboard_mode</em></span>
<code class="function">GrabModeAsync</code>.
</p><p>
If
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
is invoked on
<code class="function">ButtonPress</code>,
it calls
<a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>
on the specified shell widget.
If
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
is invoked on
<code class="function">KeyPress</code>
or
<code class="function">EnterWindow</code>,
it calls
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
on the specified shell widget with <span class="emphasis"><em>grab_kind</em></span> set to
<code class="function">XtGrabNonexclusive</code>.
Otherwise, the translation manager generates a
warning message and ignores the action.
</p><p>
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
tries to find the shell by searching the widget tree starting at
the widget in which it is invoked.
If it finds a shell with the specified name in the pop-up children of
that widget, it pops up the shell with the appropriate parameters.
Otherwise, it moves up the parent chain to find a pop-up child with the
specified name.
If
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
gets to the application top-level shell widget and has not
found a matching shell, it generates a warning and returns immediately.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Unmapping_a_Pop_Up_Widget"></a>Unmapping a Pop-Up Widget</h2></div></div></div><p>
Pop-ups can be popped down through several mechanisms:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A call to
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>
</p></li><li class="listitem"><p>
The supplied callback procedure
<a class="xref" href="#XtCallbackPopdown"><code class="function">XtCallbackPopdown</code></a>
</p></li><li class="listitem"><p>
The standard translation action
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>
</p></li></ul></div><p>
To unmap a pop-up from within an application, use
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>.
</p><div class="funcsynopsis"><a id="XtPopdown"></a><p><code class="funcdef">void <strong class="fsfunc">XtPopdown</strong>(</code>Widget <var class="pdparam">popup_shell</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>popup_shell</em></span>
</span></p></td><td><p>
Specifies the shell widget to pop down.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>
function performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Calls
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>
to ensure <span class="emphasis"><em>popup_shell</em></span>'s class is a subclass of
<code class="function">shellWidgetClass</code>.
</p></li><li class="listitem"><p>
Checks that the <span class="emphasis"><em>popped_up</em></span> field of <span class="emphasis"><em>popup_shell</em></span> is
<code class="function">True</code>;
otherwise, it returns immediately.
</p></li><li class="listitem"><p>
Unmaps <span class="emphasis"><em>popup_shell</em></span>'s window and, if <span class="emphasis"><em>override_redirect</em></span> is
<code class="function">False</code>,
sends a synthetic
<code class="function">UnmapNotify</code>
event as specified by the <span class="emphasis"><em>Inter-Client Communication Conventions Manual</em></span>.
</p></li><li class="listitem"><p>
If <span class="emphasis"><em>popup_shell</em></span>'s <span class="emphasis"><em>grab_kind</em></span> is either
<code class="function">XtGrabNonexclusive</code>
or
<code class="function">XtGrabExclusive</code>,
it calls
<a class="xref" href="#XtRemoveGrab"><code class="function">XtRemoveGrab</code></a>.
</p></li><li class="listitem"><p>
Sets <span class="emphasis"><em>popup_shell</em></span>'s <span class="emphasis"><em>popped_up</em></span> field to
<code class="function">False</code>.
</p></li><li class="listitem"><p>
Calls the callback procedures on the shell's <span class="emphasis"><em>popdown_callback</em></span> list,
specifying a pointer to the value of the shell's <span class="emphasis"><em>grab_kind</em></span> field
as the <span class="emphasis"><em>call_data</em></span> argument.
</p></li></ul></div><p>
To pop down a pop-up from a callback list, you may use the callback
<a class="xref" href="#XtCallbackPopdown"><code class="function">XtCallbackPopdown</code></a>.
</p><div class="funcsynopsis"><a id="XtCallbackPopdown"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallbackPopdown</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies a pointer to the
<code class="function">XtPopdownID</code>
structure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Specifies the callback data argument,
which is not used by this procedure.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCallbackPopdown"><code class="function">XtCallbackPopdown</code></a>
function casts the <span class="emphasis"><em>client_data</em></span> parameter to a pointer of type
<code class="function">XtPopdownID</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
Widget shell_widget;<br />
Widget enable_widget;<br />
} XtPopdownIDRec, *XtPopdownID;<br />
</p></div><p>
The <span class="emphasis"><em>shell_widget</em></span> is the pop-up shell to pop down,
and the <span class="emphasis"><em>enable_widget</em></span> is usually the widget that was used to pop it up
in one of the pop-up callback convenience procedures.
</p><p>
<a class="xref" href="#XtCallbackPopdown"><code class="function">XtCallbackPopdown</code></a>
calls
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>
with the specified <span class="emphasis"><em>shell_widget</em></span>
and then calls
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
to resensitize <span class="emphasis"><em>enable_widget</em></span>.
</p><p>
Within a translation table,
to pop down a spring-loaded menu when a key or pointer button is
released or when the
pointer is moved into a widget, use
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>
or its synonym,
<code class="function">MenuPopdown</code>.
From a translation writer's point of view,
the definition for this translation action is
</p><div class="funcsynopsis"><a id="XtMenuPopdown"></a><p><code class="funcdef">void <strong class="fsfunc">XtMenuPopdown</strong>(</code>String <var class="pdparam">shell_name</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>shell_name</em></span>
</span></p></td><td><p>
Specifies the name of the shell widget to pop down.
</p></td></tr></tbody></table></div><p>
If a shell name is not given,
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>
calls
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>
with the widget for which the translation is specified.
If <span class="emphasis"><em>shell_name</em></span> is specified in the translation table,
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>
tries to find the shell by looking up the widget tree starting at the
widget in which it is invoked.
If it finds a shell with the specified name in the pop-up children
of that widget, it pops down the shell;
otherwise, it moves up the parent chain to find a pop-up child with the
specified name.
If
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>
gets to the application top-level shell widget
and cannot find a matching shell,
it generates a warning and returns immediately.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Geometry_Management"></a>Chapter 6. Geometry Management</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Initiating_Geometry_Changes">Initiating Geometry Changes</a></span></dt><dt><span class="sect1"><a href="#General_Geometry_Manager_Requests">General Geometry Manager Requests</a></span></dt><dt><span class="sect1"><a href="#Resize_Requests">Resize Requests</a></span></dt><dt><span class="sect1"><a href="#Potential_Geometry_Changes">Potential Geometry Changes</a></span></dt><dt><span class="sect1"><a href="#Child_Geometry_Management_The_geometry_manager_Procedure">Child Geometry Management: The geometry_manager Procedure</a></span></dt><dt><span class="sect1"><a href="#Widget_Placement_and_Sizing">Widget Placement and Sizing</a></span></dt><dt><span class="sect1"><a href="#Preferred_Geometry">Preferred Geometry</a></span></dt><dt><span class="sect1"><a href="#Size_Change_Management_The_resize_Procedure">Size Change Management: The resize Procedure</a></span></dt></dl></div><p>
A widget does not directly control its size and location;
rather, its parent is responsible for controlling them.
Although the position of children is usually left up to their parent,
the widgets themselves often have the best idea of their optimal sizes
and, possibly, preferred locations.
</p><p>
To resolve physical layout conflicts between sibling widgets and between
a widget and its parent, the Intrinsics provide the geometry management mechanism.
Almost all
composite
widgets have a geometry manager specified in the <span class="emphasis"><em>geometry_manager</em></span> field
in the widget class record that is responsible for the size, position, and
stacking order of the widget's children.
The only exception is fixed boxes,
which create their children themselves and can ensure that
their children will never make a geometry request.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Initiating_Geometry_Changes"></a>Initiating Geometry Changes</h2></div></div></div><p>
Parents, children, and clients each initiate geometry changes differently.
Because a parent has absolute control of its children's geometry,
it changes the geometry directly by calling
<code class="function">XtMove\%Widget</code>,
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>,
or
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>.
A child must ask its parent for a geometry change by calling
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
or
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>.
An application or other client code initiates a geometry change by calling
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
on the appropriate geometry fields,
thereby giving the widget the opportunity to modify or reject the client
request before it gets propagated to the parent and the opportunity
to respond appropriately to the parent's reply.
</p><p>
When a widget that needs to change its size, position, border width,
or stacking depth asks its parent's geometry manager to make the desired
changes,
the geometry manager can allow the request, disallow the request, or
suggest a compromise.
</p><p>
When the geometry manager is asked to change the geometry of a child,
the geometry manager may also rearrange and resize any or all
of the other children that it controls.
The geometry manager can move children around freely using
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>.
When it resizes a child (that is, changes the width, height, or
border width) other than the one making the request,
it should do so by calling
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>.
The requesting child may be given special treatment; see
<a class="xref" href="#Child_Geometry_Management_The_geometry_manager_Procedure" title="Child Geometry Management: The geometry_manager Procedure">the section called “Child Geometry Management: The geometry_manager Procedure”</a>.
It can simultaneously move and resize a child with a single call to
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>.
</p><p>
Often, geometry managers find that they can satisfy a request only if
they can reconfigure a widget that they are not in control of; in particular,
the
composite
widget may want to change its own size.
In this case,
the geometry manager makes a request to its parent's geometry manager.
Geometry requests can cascade this way to arbitrary depth.
</p><p>
Because such cascaded arbitration of widget geometry can involve extended
negotiation,
windows are not actually allocated to widgets at application
startup until all widgets are satisfied with their geometry;
see <a class="xref" href="#Creating_Widgets" title="Creating Widgets">the section called “Creating Widgets”</a> and
<a class="xref" href="#Realizing_Widgets" title="Realizing Widgets">the section called “Realizing Widgets”</a>.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
The Intrinsics treatment of stacking requests is deficient in several areas.
Stacking requests for unrealized widgets are granted but will have no effect.
In addition, there is no way to do an
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
that will generate a stacking geometry request.
</p></li><li class="listitem"><p>
After a successful geometry request (one that returned
<code class="function">XtGeometryYes</code>),
a widget does not know whether its resize procedure has been called.
Widgets should have resize procedures that can be called more than once
without ill effects.
</p></li></ol></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="General_Geometry_Manager_Requests"></a>General Geometry Manager Requests</h2></div></div></div><p>
When making a geometry request, the child specifies an
<code class="function">XtWidgetGeometry</code>
structure.
</p><div class="literallayout"><p><br />
typedef unsigned long XtGeometryMask;<br />
typedef struct {<br />
XtGeometryMask request_mode;<br />
Position x, y;<br />
Dimension width, height;<br />
Dimension border_width;<br />
Widget sibling;<br />
int stack_mode;<br />
} XtWidgetGeometry;<br />
</p></div><p>
To make a general geometry manager request from a widget, use
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>.
</p><div class="funcsynopsis"><a id="XtMakeGeometryRequest"></a><p><code class="funcdef">XtGeometryResult <strong class="fsfunc">XtMakeGeometryRequest</strong>(</code>Widget <var class="pdparam">w</var>, XtWidgetGeometry *<var class="pdparam">request</var>, XtWidgetGeometry *<var class="pdparam">reply_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request</em></span>
</span></p></td><td><p>
Specifies the desired widget geometry (size, position, border width,
and stacking order).
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>reply_return</em></span>
</span></p></td><td><p>
Returns the allowed widget size, or may be NULL
if the requesting widget is not interested in handling
<code class="function">XtGeometryAlmost</code>.
</p></td></tr></tbody></table></div><p>
Depending on the condition,
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
performs the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
If the widget is unmanaged or the widget's parent is not realized,
it makes the changes and returns
<code class="function">XtGeometryYes</code>.
</p></li><li class="listitem"><p>
If the parent's class is not a subclass of
<code class="function">compositeWidgetClass</code>
or the parent's <span class="emphasis"><em>geometry_manager</em></span> field is NULL,
it issues an error.
</p></li><li class="listitem"><p>
If the widget's <span class="emphasis"><em>being_destroyed</em></span> field is
<code class="function">True</code>,
it returns
<code class="function">XtGeometryNo</code>.
</p></li><li class="listitem"><p>
If the widget <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>, and
<span class="emphasis"><em>border_width</em></span> fields are
all equal to the requested values,
it returns
<code class="function">XtGeometryYes</code>;
otherwise, it calls the parent's geometry_manager procedure
with the given parameters.
</p></li><li class="listitem"><p>
If the parent's geometry manager returns
<code class="function">XtGeometryYes</code>
and if
<code class="function">XtCWQueryOnly</code>
is not set in <span class="emphasis"><em>request->request_mode</em></span>
and if the widget is realized,
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
calls the
<code class="function">XConfigureWindow</code>
Xlib function to reconfigure the widget's window (set its size, location,
and stacking order as appropriate).
</p></li><li class="listitem"><p>
If the geometry manager returns
<code class="function">XtGeometryDone</code>,
the change has been approved and actually has been done.
In this case,
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
does no configuring and returns
<code class="function">XtGeometryYes</code>.
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
never returns
<code class="function">XtGeometryDone</code>.
</p></li><li class="listitem"><p>
Otherwise,
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
just returns the resulting value from the parent's geometry manager.
</p></li></ul></div><p>
Children of primitive widgets are always unmanaged; therefore,
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
always returns
<code class="function">XtGeometryYes</code>
when called by a child of a primitive widget.
</p><p>
The return codes from geometry managers are
</p><div class="literallayout"><p><br />
typedef enum {<br />
XtGeometryYes,<br />
XtGeometryNo,<br />
XtGeometryAlmost,<br />
XtGeometryDone<br />
} XtGeometryResult;<br />
</p></div><p>
The <span class="emphasis"><em>request_mode</em></span> definitions are from
<code class="function"><X11/X.h></code>.
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><tbody><tr><td align="left">#define</td><td align="left"><code class="function">CWX</code></td><td align="left">(1<<0)</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">CWY</code></td><td align="left">(1<<1)</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">CWWidth</code></td><td align="left">(1<<2)</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">CWHeight</code></td><td align="left">(1<<3)</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">CWBorderWidth</code></td><td align="left">(1<<4)</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">CWSibling</code></td><td align="left">(1<<5)</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">CWStackMode</code></td><td align="left">(1<<6)</td></tr></tbody></table></div><p>
The Intrinsics also support the following value.
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><tbody><tr><td align="left">#define</td><td align="left"><code class="function">XtCWQueryOnly</code></td><td align="left">(1<<7)</td></tr></tbody></table></div><p>
<code class="function">XtCWQueryOnly</code>
indicates that the corresponding geometry request is only a query
as to what would happen if this geometry request were made
and that no widgets should actually be changed.
</p><p>
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>,
like the
<code class="function">XConfigureWindow</code>
Xlib function, uses <span class="emphasis"><em>request_mode</em></span> to determine which fields in the
<code class="function">XtWidgetGeometry</code>
structure the caller wants to specify.
</p><p>
The <span class="emphasis"><em>stack_mode</em></span> definitions are from
<code class="function"><X11/X.h></code>:
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><tbody><tr><td align="left">#define</td><td align="left"><code class="function">Above</code></td><td align="left">0</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">Below</code></td><td align="left">1</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">TopIf</code></td><td align="left">2</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">BottomIf</code></td><td align="left">3</td></tr><tr><td align="left">#define</td><td align="left"><code class="function">Opposite</code></td><td align="left">4</td></tr></tbody></table></div><p>
The Intrinsics also support the following value.
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><tbody><tr><td align="left">#define</td><td align="left"><code class="function">XtSMDontChange</code></td><td align="left">5</td></tr></tbody></table></div><p>
For definition and behavior of
<code class="function">Above</code>,
<code class="function">Below</code>,
<code class="function">TopIf</code>,
<code class="function">BottomIf</code>,
and
<code class="function">Opposite</code>,
<span class="olink">BLAH</span>
in <span class="olink">Xlib — C Language X Interface.</span>.
<code class="function">XtSMDontChange</code>
indicates that the widget wants its current stacking order preserved.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Resize_Requests"></a>Resize Requests</h2></div></div></div><p>
To make a simple resize request from a widget, you can use
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>
as an alternative to
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>.
</p><div class="funcsynopsis"><a id="XtMakeResizeRequest"></a><p><code class="funcdef">typedef XtGeometryResult <strong class="fsfunc">XtMakeResizeRequest</strong>(</code>Widget <var class="pdparam">w</var>, Dimension <var class="pdparam">width</var>, Dimension *<var class="pdparam">width_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>width</em></span>
</span></p></td><td><p>
Specify the desired widget width and height.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>height</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>width_return</em></span>
</span></p></td><td><p>
Return the allowed widget width and height.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>height_return</em></span>
</span></p></td><td><p></p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>
function, a simple interface to
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>,
creates an
<code class="function">XtWidgetGeometry</code>
structure and specifies that width and height should change
by setting <span class="emphasis"><em>request_mode</em></span> to
<code class="function">CWWidth</code>
<code class="function">|</code>
<code class="function">CWHeight</code>.
The geometry manager is free to modify any of the other window attributes
(position or stacking order) to satisfy the resize request.
If the return value is
<code class="function">XtGeometryAlmost</code>,
<span class="emphasis"><em>width_return</em></span> and <span class="emphasis"><em>height_return</em></span> contain a compromise width and height.
If these are acceptable,
the widget should immediately call
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>
again and request that the compromise width and height be applied.
If the widget is not interested in
<code class="function">XtGeometryAlmost</code>
replies,
it can pass NULL for <span class="emphasis"><em>width_return</em></span> and <span class="emphasis"><em>height_return</em></span>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Potential_Geometry_Changes"></a>Potential Geometry Changes</h2></div></div></div><p>
Sometimes a geometry manager cannot respond to
a geometry request from a child without first making a geometry request
to the widget's own parent (the original requestor's grandparent).
If the request to the grandparent would allow the parent to satisfy the
original request,
the geometry manager can make the intermediate geometry request
as if it were the originator.
On the other hand,
if the geometry manager already has determined that the original request
cannot be completely satisfied (for example, if it always denies
position changes),
it needs to tell the grandparent to respond to the intermediate request
without actually changing the geometry
because it does not know if the child will accept the compromise.
To accomplish this, the geometry manager uses
<code class="function">XtCWQueryOnly</code>
in the intermediate request.
</p><p>
When
<code class="function">XtCWQueryOnly</code>
is used, the geometry manager needs to cache
enough information to exactly reconstruct the intermediate request.
If the grandparent's response to the intermediate query was
<code class="function">XtGeometryAlmost</code>,
the geometry manager needs to cache the entire
reply geometry in the event the child accepts the parent's compromise.
</p><p>
If the grandparent's response was
<code class="function">XtGeometryAlmost</code>,
it may also be necessary to cache the entire reply geometry from
the grandparent when
<code class="function">XtCWQueryOnly</code>
is not used.
If the geometry manager is still able to satisfy the original request,
it may immediately accept the grandparent's compromise
and then act on the child's request.
If the grandparent's compromise geometry is insufficient to allow
the child's request and if the geometry manager is willing to offer
a different compromise to the child,
the grandparent's compromise should not be accepted until the child
has accepted the new compromise.
</p><p>
Note that a compromise geometry returned with
<code class="function">XtGeometryAlmost</code>
is guaranteed only for the next call to the same widget;
therefore, a cache of size 1 is sufficient.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Child_Geometry_Management_The_geometry_manager_Procedure"></a>Child Geometry Management: The geometry_manager Procedure</h2></div></div></div><p>
The geometry_manager procedure pointer in a composite widget class is of type
<a class="xref" href="#XtGeometryHandler"><code class="function">*XtGeometryHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtGeometryHandler"></a><p><code class="funcdef">XtGeometryResult <strong class="fsfunc">*XtGeometryHandler</strong>(</code>Widget <var class="pdparam">w</var>, XtWidgetGeometry *<var class="pdparam">request</var>, XtWidgetGeometry *<var class="pdparam">geometry_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Passes the widget making the request.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request</em></span>
</span></p></td><td><p>
Passes the new geometry the child desires.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>geometry_return</em></span>
</span></p></td><td><p>
Passes a geometry structure in which the geometry manager may store a
compromise.
</p></td></tr></tbody></table></div><p>
A class can inherit its superclass's geometry manager during class
initialization.
</p><p>
A bit set to zero in the request's <span class="emphasis"><em>request_mode</em></span>
field means that the child widget
does not care about the value of the corresponding field,
so the geometry manager can change this field as it wishes.
A bit set to 1 means that the child wants that geometry element set
to the value in the corresponding field.
</p><p>
If the geometry manager can satisfy all changes requested
and if
<code class="function">XtCWQueryOnly</code>
is not specified,
it updates the widget's <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>,
and <span class="emphasis"><em>border_width</em></span> fields
appropriately.
Then, it returns
<code class="function">XtGeometryYes</code>,
and the values pointed to by the <span class="emphasis"><em>geometry_return</em></span> argument are undefined.
The widget's window is moved and resized automatically by
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>.
</p><p>
Homogeneous composite widgets often find it convenient to treat the widget
making the request the same as any other widget, including reconfiguring
it using
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>
or
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
as part of its layout process, unless
<code class="function">XtCWQueryOnly</code>
is specified.
If it does this,
it should return
<code class="function">XtGeometryDone</code>
to inform
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
that it does not need to do the configuration itself.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
To remain
compatible with layout techniques used in older widgets (before
<code class="function">XtGeometryDone</code>
was added to the Intrinsics), a geometry manager should avoid using
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
or
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>
on the child making
the request because the layout process of the child may be in an
intermediate state in which it is not prepared to handle a call to its
resize procedure. A self-contained widget set may choose this
alternative geometry management scheme, however, provided that it
clearly warns widget developers of the compatibility consequences.
</p></div><p>
Although
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
resizes the widget's window
(if the geometry
manager returns
<code class="function">XtGeometryYes ),</code>
it does not call the widget class's resize procedure.
The requesting widget must perform whatever
resizing calculations are needed explicitly.
</p><p>
If the geometry manager disallows the request,
the widget cannot change its geometry.
The values pointed to by <span class="emphasis"><em>geometry_return</em></span> are undefined,
and the geometry manager returns
<code class="function">XtGeometryNo</code>.
</p><p>
Sometimes the geometry manager cannot satisfy the request exactly
but may be able to satisfy a similar request.
That is,
it could satisfy only a subset of the requests (for example,
size but not position) or a lesser request
(for example, it cannot make the child as big as the
request but it can make the child bigger than its current size).
In such cases,
the geometry manager fills in the structure pointed to by
<span class="emphasis"><em>geometry_return</em></span> with the actual changes
it is willing to make, including an appropriate <span class="emphasis"><em>request_mode</em></span> mask, and returns
<code class="function">XtGeometryAlmost</code>.
If a bit in <span class="emphasis"><em>geometry_return->request_mode</em></span> is zero,
the geometry manager agrees not to change the corresponding value
if <span class="emphasis"><em>geometry_return</em></span> is used immediately
in a new request.
If a bit is 1,
the geometry manager does change that element to the corresponding
value in <span class="emphasis"><em>geometry_return</em></span>.
More bits may be set in <span class="emphasis"><em>geometry_return->request_mode</em></span>
than in the original request if
the geometry manager intends to change other fields should the
child accept the compromise.
</p><p>
When
<code class="function">XtGeometryAlmost</code>
is returned,
the widget must decide if the compromise suggested in <span class="emphasis"><em>geometry_return</em></span>
is acceptable.
If it is, the widget must not change its geometry directly;
rather, it must make another call to
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>.
</p><p>
If the next geometry request from this child uses the
<span class="emphasis"><em>geometry_return</em></span> values filled in by the geometry manager with an
<code class="function">XtGeometryAlmost</code>
return and if there have been no intervening geometry requests on
either its parent or any of its other children,
the geometry manager must grant the request, if possible.
That is, if the child asks immediately with the returned geometry,
it should get an answer of
<code class="function">XtGeometryYes</code>.
However,
dynamic behavior in
the user's window manager may affect the final outcome.
</p><p>
To return
<code class="function">XtGeometryYes</code>,
the geometry manager frequently rearranges the position of other managed
children by calling
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>.
However, a few geometry managers may sometimes change the
size of other managed children by calling
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
or
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>.
If
<code class="function">XtCWQueryOnly</code>
is specified,
the geometry manager must return data describing
how it would react to this geometry
request without actually moving or resizing any widgets.
</p><p>
Geometry managers must not assume that the <span class="emphasis"><em>request</em></span>
and <span class="emphasis"><em>geometry_return</em></span> arguments point to independent storage.
The caller is permitted to use the same field for both,
and the geometry manager must allocate its own temporary storage,
if necessary.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Widget_Placement_and_Sizing"></a>Widget Placement and Sizing</h2></div></div></div><p>
To move a sibling widget of the child making the geometry request,
the parent uses
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtMoveWidget"></a><p><code class="funcdef">void <strong class="fsfunc">XtMoveWidget</strong>(</code>Widget <var class="pdparam">w</var>, Position <var class="pdparam">x</var>, Position <var class="pdparam">y</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>x</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>y</em></span>
</span></p></td><td><p>
Specify the new widget x and y coordinates.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>
function returns immediately if the specified geometry fields
are the same as the old values.
Otherwise,
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>
writes the new <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>y</em></span> values into the object
and, if the object is a widget and is realized, issues an Xlib
<code class="function">XMoveWindow</code>
call on the widget's window.
</p><p>
To resize a sibling widget of the child making the geometry request,
the parent uses
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtResizeWidget"></a><p><code class="funcdef">void <strong class="fsfunc">XtResizeWidget</strong>(</code>Widget <var class="pdparam">w</var>, Dimension <var class="pdparam">width</var>, Dimension <var class="pdparam">height</var>, Dimension <var class="pdparam">border_width</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>width</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>height</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>border_width</em></span>
</span></p></td><td><p>
Specify the new widget size.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
function returns immediately if the specified geometry fields
are the same as the old values.
Otherwise,
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
writes the new <span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>, and <span class="emphasis"><em>border_width</em></span> values into
the object and, if the object is a widget and is realized, issues an
<code class="function">XConfigureWindow</code>
call on the widget's window.
</p><p>
If the new width or height is different from the old values,
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
calls the object's resize procedure to notify it of the size change.
</p><p>
To move and resize the sibling widget of the child making the geometry request,
the parent uses
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtConfigureWidget"></a><p><code class="funcdef">void <strong class="fsfunc">XtConfigureWidget</strong>(</code>Widget <var class="pdparam">w</var>, Position <var class="pdparam">x</var>, Position <var class="pdparam">y</var>, Dimension <var class="pdparam">width</var>, Dimension <var class="pdparam">height</var>, Dimension <var class="pdparam">border_width</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>x</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>y</em></span>
</span></p></td><td><p>
Specify the new widget x and y coordinates.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>width</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>height</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>border_width</em></span>
</span></p></td><td><p>
Specify the new widget size.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>
function returns immediately if the specified new geometry fields
are all equal to the current values.
Otherwise,
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>
writes the new <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>,
and <span class="emphasis"><em>border_width</em></span> values
into the object and, if the object is a widget and is realized, makes an Xlib
<code class="function">XConfigureWindow</code>
call on the widget's window.
</p><p>
If the new width or height is different from its old value,
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>
calls the object's resize procedure to notify it of the size change;
otherwise, it simply returns.
</p><p>
To resize a child widget that already has the new values of its width,
height, and border width, the parent uses
<a class="xref" href="#XtResizeWindow"><code class="function">XtResizeWindow</code></a>.
</p><div class="funcsynopsis"><a id="XtResizeWindow"></a><p><code class="funcdef">void <strong class="fsfunc">XtResizeWindow</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtResizeWindow"><code class="function">XtResizeWindow</code></a>
function calls the
<code class="function">XConfigureWindow</code>
Xlib function to make the window of the specified widget match its width,
height, and border width.
This request is done unconditionally because there is no
inexpensive way to tell if these
values match the current values.
Note that the widget's resize procedure is not called.
</p><p>
There are very few times to use
<a class="xref" href="#XtResizeWindow"><code class="function">XtResizeWindow</code></a>;
instead, the parent should use
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Preferred_Geometry"></a>Preferred Geometry</h2></div></div></div><p>
Some parents may be willing to adjust their layouts to accommodate the
preferred geometries of their children.
They can use
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
to obtain the preferred geometry
and, as they see fit, can use or ignore any portion of the response.
</p><p>
To query a child widget's preferred geometry, use
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>.
</p><div class="funcsynopsis"><a id="XtQueryGeometry"></a><p><code class="funcdef">XtGeometryResult <strong class="fsfunc">XtQueryGeometry</strong>(</code>Widget <var class="pdparam">w</var>, XtWidgetGeometry *<var class="pdparam">intended</var>, XtWidgetGeometry *<var class="pdparam">preferred_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>intended</em></span>
</span></p></td><td><p>
Specifies the new geometry the parent plans to give to the child, or
NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>preferred_return</em></span>
</span></p></td><td><p>
Returns the child widget's preferred geometry.
</p></td></tr></tbody></table></div><p>
To discover a child's preferred geometry,
the child's parent stores the new
geometry in the corresponding fields of
the intended structure, sets the corresponding bits in <span class="emphasis"><em>intended.request_mode</em></span>,
and calls
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>.
The parent should set only those fields that are important to it so
that the child can determine whether it may be able to attempt changes to
other fields.
</p><p>
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
clears all bits in the <span class="emphasis"><em>preferred_return->request_mode</em></span>
field and checks the
<span class="emphasis"><em>query_geometry</em></span> field of the specified widget's class record.
If <span class="emphasis"><em>query_geometry</em></span> is not NULL,
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
calls the query_geometry procedure and passes as arguments the
specified widget, <span class="emphasis"><em>intended</em></span>, and <span class="emphasis"><em>preferred_return</em></span> structures.
If the <span class="emphasis"><em>intended</em></span> argument is NULL,
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
replaces it with a pointer to an
<code class="function">XtWidgetGeometry</code>
structure with <span class="emphasis"><em>request_mode</em></span> equal to zero before calling the
query_geometry procedure.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
If
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
is called from within a geometry_manager
procedure for the widget that issued
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
or
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>,
the results
are not guaranteed to be consistent with the requested changes. The
change request passed to the geometry manager takes precedence over
the preferred geometry.
</p></div><p>
The query_geometry procedure pointer is of type
<a class="xref" href="#XtGeometryHandler"><code class="function">*XtGeometryHandler</code></a>.
</p><div class="funcsynopsis"><a id="_XtGeometryHandler"></a><p><code class="funcdef">typedef XtGeometryResult <strong class="fsfunc">(*XtGeometryHandler)</strong>(</code>Widget <var class="pdparam">w</var>, XtWidgetGeometry *<var class="pdparam">request</var>, XtWidgetGeometry *<var class="pdparam">preferred_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Passes the child widget whose preferred geometry is required.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request</em></span>
</span></p></td><td><p>
Passes the geometry changes that the parent plans to make.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>preferred_return</em></span>
</span></p></td><td><p>
Passes a structure in which the child returns its preferred geometry.
</p></td></tr></tbody></table></div><p>
The query_geometry procedure is expected to examine the bits set in
<span class="emphasis"><em>request->request_mode</em></span>, evaluate the preferred geometry of the widget,
and store the result in <span class="emphasis"><em>preferred_return</em></span>
(setting the bits in <span class="emphasis"><em>preferred_return->request_mode</em></span> corresponding
to those geometry fields that it cares about).
If the proposed geometry change is acceptable without modification,
the query_geometry procedure should return
<code class="function">XtGeometryYes</code>.
If at least one field in <span class="emphasis"><em>preferred_return</em></span>
with a bit set in <span class="emphasis"><em>preferred_return->request_mode</em></span>
is different
from the corresponding field in <span class="emphasis"><em>request</em></span>
or if a bit was set in <span class="emphasis"><em>preferred_return->request_mode</em></span>
that was not set in the request,
the query_geometry procedure should return
<code class="function">XtGeometryAlmost</code>.
If the preferred geometry is identical to the current geometry,
the query_geometry procedure should return
<code class="function">XtGeometryNo</code>.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
The query_geometry procedure may assume
that no
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>
or
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
is in progress
for the specified widget; that is, it is not required to construct
a reply consistent with the requested geometry if such a request
were actually outstanding.
</p></div><p>
After calling the query_geometry procedure
or if the <span class="emphasis"><em>query_geometry</em></span> field is NULL,
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
examines all the unset bits in <span class="emphasis"><em>preferred_return->request_mode</em></span>
and sets the corresponding fields in <span class="emphasis"><em>preferred_return</em></span>
to the current values from the widget instance.
If
<code class="function">CWStackMode</code>
is not set,
the <span class="emphasis"><em>stack_mode</em></span> field is set to
<code class="function">XtSMDontChange</code>.
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
returns the value returned by the query_geometry procedure or
<code class="function">XtGeometryYes</code>
if the <span class="emphasis"><em>query_geometry</em></span> field is NULL.
</p><p>
Therefore, the caller can interpret a return of
<code class="function">XtGeometryYes</code>
as not needing to evaluate the contents of the reply and, more important,
not needing to modify its layout plans.
A return of
<code class="function">XtGeometryAlmost</code>
means either that both the parent and the child expressed interest
in at least one common field and the child's preference does not match
the parent's intentions or that the child expressed interest in a field that
the parent might need to consider.
A return value of
<code class="function">XtGeometryNo</code>
means that both the parent and the child expressed interest in a field and
that the child suggests that the field's current value in the widget instance
is its preferred value.
In addition, whether or not the caller ignores the return value or the
reply mask, it is guaranteed that the <span class="emphasis"><em>preferred_return</em></span> structure contains complete
geometry information for the child.
</p><p>
Parents are expected to call
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
in their layout routine and wherever else the information is significant
after change_managed has been called.
The first time it is invoked,
the changed_managed procedure may assume that the child's current geometry
is its preferred geometry.
Thus, the child is still responsible for storing values
into its own geometry during its initialize procedure.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Size_Change_Management_The_resize_Procedure"></a>Size Change Management: The resize Procedure</h2></div></div></div><p>
A child can be resized by its parent at any time.
Widgets usually need to know when they have changed size
so that they can lay out their displayed data again to match the new size.
When a parent resizes a child, it calls
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>,
which updates the geometry fields in the widget,
configures the window if the widget is realized,
and calls the child's resize procedure to notify the child.
The resize procedure pointer is of type
<a class="xref" href="#XtWidgetProc"><code class="function">XtWidgetProc</code></a>.
</p><p>
If a class need not recalculate anything when a widget is resized,
it can specify NULL for the <span class="emphasis"><em>resize</em></span> field in its class record.
This is an unusual case and should occur only for widgets
with very trivial display semantics.
The resize procedure takes a widget as its only argument.
The <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>,
and <span class="emphasis"><em>border_width</em></span> fields of the widget contain the new values.
The resize procedure should recalculate the layout of internal data
as needed.
(For example, a centered Label in a window that changes size
should recalculate the starting position of the text.)
The widget must obey resize as a command and must not treat it as a request.
A widget must not issue an
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
or
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>
call from its resize procedure.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Event_Management"></a>Chapter 7. Event Management</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Adding_and_Deleting_Additional_Event_Sources">Adding and Deleting Additional Event Sources</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Adding_and_Removing_Input_Sources">Adding and Removing Input Sources</a></span></dt><dt><span class="sect2"><a href="#Adding_and_Removing_Blocking_Notifications">Adding and Removing Blocking Notifications</a></span></dt><dt><span class="sect2"><a href="#Adding_and_Removing_Timeouts">Adding and Removing Timeouts</a></span></dt><dt><span class="sect2"><a href="#Adding_and_Removing_Signal_Callbacks">Adding and Removing Signal Callbacks</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Constraining_Events_to_a_Cascade_of_Widgets">Constraining Events to a Cascade of Widgets</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Requesting_Key_and_Button_Grabs">Requesting Key and Button Grabs</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Focusing_Events_on_a_Child">Focusing Events on a Child</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Events_for_Drawables_That_Are_Not_a_Widget_s_Window">Events for Drawables That Are Not a Widget's Window</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Querying_Event_Sources">Querying Event Sources</a></span></dt><dt><span class="sect1"><a href="#Dispatching_Events">Dispatching Events</a></span></dt><dt><span class="sect1"><a href="#The_Application_Input_Loop">The Application Input Loop</a></span></dt><dt><span class="sect1"><a href="#Setting_and_Checking_the_Sensitivity_State_of_a_Widget">Setting and Checking the Sensitivity State of a Widget</a></span></dt><dt><span class="sect1"><a href="#Adding_Background_Work_Procedures">Adding Background Work Procedures</a></span></dt><dt><span class="sect1"><a href="#X_Event_Filters">X Event Filters</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Pointer_Motion_Compression">Pointer Motion Compression</a></span></dt><dt><span class="sect2"><a href="#Enter_Leave_Compression">Enter/Leave Compression</a></span></dt><dt><span class="sect2"><a href="#Exposure_Compression">Exposure Compression</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Widget_Exposure_and_Visibility">Widget Exposure and Visibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Redisplay_of_a_Widget_The_expose_Procedure">Redisplay of a Widget: The expose Procedure</a></span></dt><dt><span class="sect2"><a href="#Widget_Visibility">Widget Visibility</a></span></dt></dl></dd><dt><span class="sect1"><a href="#X_Event_Handlers">X Event Handlers</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Event_Handlers_That_Select_Events">Event Handlers That Select Events</a></span></dt><dt><span class="sect2"><a href="#Event_Handlers_That_Do_Not_Select_Events">Event Handlers That Do Not Select Events</a></span></dt><dt><span class="sect2"><a href="#Current_Event_Mask">Current Event Mask</a></span></dt><dt><span class="sect2"><a href="#Event_Handlers_for_X_Protocol_Extensions">Event Handlers for X11 Protocol Extensions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Using_the_Intrinsics_in_a_Multi_Threaded_Environment">Using the Intrinsics in a Multi-Threaded Environment</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Initializing_a_Multi_Threaded_Intrinsics_Application">Initializing a Multi-Threaded Intrinsics Application</a></span></dt><dt><span class="sect2"><a href="#Locking_tk_Data_Structures">Locking X Toolkit Data Structures</a></span></dt><dt><span class="sect2"><a href="#Event_Management_in_a_Multi_Threaded_Environment">Event Management in a Multi-Threaded Environment</a></span></dt></dl></dd></dl></div><p>
While Xlib allows the reading and processing of events anywhere in an application,
widgets in the X Toolkit neither directly read events
nor grab the server or pointer.
Widgets register procedures that are to be called
when an event or class of events occurs in that widget.
</p><p>
A typical application consists of startup code followed by an event loop
that reads events and dispatches them by calling
the procedures that widgets have registered.
The default event loop provided by the Intrinsics is
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>.
</p><p>
The event manager is a collection of functions to perform the following tasks:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Add or remove event sources other than X server events (in particular,
timer interrupts, file input, or POSIX signals).
</p></li><li class="listitem"><p>
Query the status of event sources.
</p></li><li class="listitem"><p>
Add or remove procedures to be called when an event occurs for a particular
widget.
</p></li><li class="listitem"><p>
Enable and
disable the dispatching of user-initiated events (keyboard and pointer events)
for a particular widget.
</p></li><li class="listitem"><p>
Constrain the dispatching of events to a cascade of pop-up widgets.
</p></li><li class="listitem"><p>
Register procedures to be called when specific events arrive.
</p></li><li class="listitem"><p>
Register procedures to be called when the Intrinsics will block.
</p></li><li class="listitem"><p>
Enable safe operation in a multi-threaded environment.
</p></li></ul></div><p>
Most widgets do not need to call any of the event handler functions explicitly.
The normal interface to X events is through the higher-level
translation manager,
which maps sequences of X events, with modifiers, into procedure calls.
Applications rarely use any of the event manager routines besides
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Adding_and_Deleting_Additional_Event_Sources"></a>Adding and Deleting Additional Event Sources</h2></div></div></div><p>
While most applications are driven only by X events,
some applications need to incorporate other sources of input
into the Intrinsics event-handling mechanism.
The event manager provides routines to integrate notification of timer events
and file data pending into this mechanism.
</p><p>
The next section describes functions that provide input gathering from files.
The application registers the files with the Intrinsics read routine.
When input is pending on one of the files,
the registered callback procedures are invoked.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Adding_and_Removing_Input_Sources"></a>Adding and Removing Input Sources</h3></div></div></div><p>
To register a new file as an input source for a given application context, use
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddInput"></a><p><code class="funcdef">XtInputId <strong class="fsfunc">XtAppAddInput</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, int <var class="pdparam">source</var>, XtPointer <var class="pdparam">condition</var>, XtInputCallbackProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>source</em></span>
</span></p></td><td><p>
Specifies the source file descriptor on a POSIX-based system
or other operating-system-dependent device specification.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>condition</em></span>
</span></p></td><td><p>
Specifies the mask that indicates a read, write, or exception condition
or some other operating-system-dependent condition.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called when the condition is found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies an argument passed to the specified procedure
when it is called.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>
function registers with the Intrinsics read routine a new source of events,
which is usually file input but can also be file output.
Note that <span class="emphasis"><em>file</em></span> should be loosely interpreted to mean any sink
or source of data.
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>
also specifies the conditions under which the source can generate events.
When an event is pending on this source,
the callback procedure is called.
</p><p>
The legal values for the <span class="emphasis"><em>condition</em></span> argument are operating-system-dependent.
On a POSIX-based system,
<span class="emphasis"><em>source</em></span> is a file number and the condition is some union of the following:
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="strong"><strong>XtInputReadMask</strong></span>
</span></p></td><td><p>
Specifies that <span class="emphasis"><em>proc</em></span> is to be called when <span class="emphasis"><em>source</em></span> has data to be read.
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>XtInputWriteMask</strong></span>
</span></p></td><td><p>
Specifies that <span class="emphasis"><em>proc</em></span> is to be called when <span class="emphasis"><em>source</em></span> is ready
for writing.
</p></td></tr><tr><td><p><span class="term">
<span class="strong"><strong>XtInputExceptMask</strong></span>
</span></p></td><td><p>
Specifies that <span class="emphasis"><em>proc</em></span> is to be called when <span class="emphasis"><em>source</em></span> has
exception data.
</p></td></tr></tbody></table></div><p>
</p><p>
Callback procedure pointers used to handle file events are of
type
<a class="xref" href="#XtInputCallbackProc"><code class="function">(*XtInputCallbackProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtInputCallbackProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtInputCallbackProc)</strong>(</code>XtPointer <var class="pdparam">client_data</var>, int *<var class="pdparam">source</var>, XtInputId *<var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Passes the client data argument that was registered for this procedure in
<code class="function">XtApp\%AddInput</code>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>source</em></span>
</span></p></td><td><p>
Passes the source file descriptor generating the event.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Passes the id returned from the corresponding
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>
call.
</p></td></tr></tbody></table></div><p>
See <a class="xref" href="#Using_the_Intrinsics_in_a_Multi_Threaded_Environment" title="Using the Intrinsics in a Multi-Threaded Environment">the section called “Using the Intrinsics in a Multi-Threaded Environment”</a>
for information regarding the use of
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>
in multiple threads.
</p><p>
To discontinue a source of input, use
<a class="xref" href="#XtRemoveInput"><code class="function">XtRemoveInput</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveInput"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveInput</strong>(</code>XtInputId <var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Specifies the id returned from the corresponding
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>
call.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveInput"><code class="function">XtRemoveInput</code></a>
function causes the Intrinsics read routine to stop watching for events
from the file source specified by <span class="emphasis"><em>id</em></span>.
</p><p>
See <a class="xref" href="#Using_the_Intrinsics_in_a_Multi_Threaded_Environment" title="Using the Intrinsics in a Multi-Threaded Environment">the section called “Using the Intrinsics in a Multi-Threaded Environment”</a>
for information regarding the use of
<a class="xref" href="#XtRemoveInput"><code class="function">XtRemoveInput</code></a>
in multiple threads.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Adding_and_Removing_Blocking_Notifications"></a>Adding and Removing Blocking Notifications</h3></div></div></div><p>
Occasionally it is desirable for an application to receive notification
when the Intrinsics event manager detects no pending input from file sources
and no pending input from X server event sources and is about to block
in an operating system call.
</p><p>
To register a hook that is called immediately prior to event blocking, use
<a class="xref" href="#XtAppAddBlockHook"><code class="function">XtAppAddBlockHook</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddBlockHook"></a><p><code class="funcdef">XtBlockHookId <strong class="fsfunc">XtAppAddBlockHook</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtBlockHookProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called before blocking.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies an argument passed to the specified procedure when it is called.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppAddBlockHook"><code class="function">XtAppAddBlockHook</code></a>
function registers the specified procedure and returns an identifier for it.
The hook procedure <span class="emphasis"><em>proc</em></span> is called at any time in the future when
the Intrinsics are about to block pending some input.
</p><p>
The procedure pointers used to provide notification of event blocking
are of type
<a class="xref" href="#XtBlockHookProc"><code class="function">*XtBlockHookProc</code></a>.
</p><div class="funcsynopsis"><a id="XtBlockHookProc"></a><p><code class="funcdef">void <strong class="fsfunc">*XtBlockHookProc</strong>(</code>XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Passes the client data argument that was registered for this procedure in
<code class="function">XtApp\%AddBlockHook</code>.
</p></td></tr></tbody></table></div><p>
To discontinue the use of a procedure for blocking notification, use
<a class="xref" href="#XtRemoveBlockHook"><code class="function">XtRemoveBlockHook</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveBlockHook"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveBlockHook</strong>(</code>XtBlockHookId <var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Specifies the identifier returned from the corresponding call to
<a class="xref" href="#XtAppAddBlockHook"><code class="function">XtAppAddBlockHook</code></a>.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveBlockHook"><code class="function">XtRemoveBlockHook</code></a>
function removes the specified procedure from the list of procedures
that are called by the Intrinsics read routine before blocking on event sources.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Adding_and_Removing_Timeouts"></a>Adding and Removing Timeouts</h3></div></div></div><p>
The timeout facility notifies the application or the widget
through a callback procedure that a specified time interval has elapsed.
Timeout values are uniquely identified by an interval id.
</p><p>
To register a timeout callback, use
<a class="xref" href="#XtAppAddTimeOut"><code class="function">XtAppAddTimeOut</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddTimeOut"></a><p><code class="funcdef">XtIntervalId <strong class="fsfunc">XtAppAddTimeOut</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, unsigned long <var class="pdparam">interval</var>, XtTimerCallbackProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context for which the timer is to be set.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>interval</em></span>
</span></p></td><td><p>
Specifies the time interval in milliseconds.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called when the time expires.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies an argument passed to the specified procedure
when it is called.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppAddTimeOut"><code class="function">XtAppAddTimeOut</code></a>
function creates a timeout and returns an identifier for it.
The timeout value is set to <span class="emphasis"><em>interval</em></span>.
The callback procedure <span class="emphasis"><em>proc</em></span> is called when
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>
or
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>
is next called after the time interval elapses,
and then the timeout is removed.
</p><p>
Callback procedure pointers used with timeouts are of
type
<a class="xref" href="#XtTimerCallbackProc"><code class="function">*XtTimerCallbackProc</code></a>.
</p><div class="funcsynopsis"><a id="XtTimerCallbackProc"></a><p><code class="funcdef">void <strong class="fsfunc">*XtTimerCallbackProc</strong>(</code>XtPointer <var class="pdparam">client_data</var>, XtIntervalId *<var class="pdparam">timer</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Passes the client data argument that was registered for this procedure in
<code class="function">XtApp\%AddTimeOut</code>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>timer</em></span>
</span></p></td><td><p>
Passes the id returned from the corresponding
<a class="xref" href="#XtAppAddTimeOut"><code class="function">XtAppAddTimeOut</code></a>
call.
</p></td></tr></tbody></table></div><p>
See <a class="xref" href="#Using_the_Intrinsics_in_a_Multi_Threaded_Environment" title="Using the Intrinsics in a Multi-Threaded Environment">the section called “Using the Intrinsics in a Multi-Threaded Environment”</a>
for information regarding the use of
<a class="xref" href="#XtAppAddTimeOut"><code class="function">XtAppAddTimeOut</code></a>
in multiple threads.
</p><p>
To clear a timeout value, use
<a class="xref" href="#XtRemoveTimeOut"><code class="function">XtRemoveTimeOut</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveTimeOut"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveTimeOut</strong>(</code>XtIntervalId <var class="pdparam">timer</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>timer</em></span>
</span></p></td><td><p>
Specifies the id for the timeout request to be cleared.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveTimeOut"><code class="function">XtRemoveTimeOut</code></a>
function removes the pending timeout.
Note that timeouts are automatically removed once they trigger.
</p><p>
Please refer to Section 7.12 for information regarding the use of
<a class="xref" href="#XtRemoveTimeOut"><code class="function">XtRemoveTimeOut</code></a>
in multiple threads.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Adding_and_Removing_Signal_Callbacks"></a>Adding and Removing Signal Callbacks</h3></div></div></div><p>
The signal facility notifies the application or the widget through a
callback procedure that a signal or other external asynchronous event
has occurred. The registered callback procedures are uniquely identified
by a signal id.
</p><p>
Prior to establishing a signal handler, the application or widget should
call
<a class="xref" href="#XtAppAddSignal"><code class="function">XtAppAddSignal</code></a>
and store the resulting identifier in a place accessible to the signal
handler. When a signal arrives, the signal handler should call
<a class="xref" href="#XtNoticeSignal"><code class="function">XtNoticeSignal</code></a>
to notify the Intrinsics that a signal has occured. To register a signal
callback use
<a class="xref" href="#XtAppAddSignal"><code class="function">XtAppAddSignal</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddSignal"></a><p><code class="funcdef">XtSignalId <strong class="fsfunc">XtAppAddSignal</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtSignalCallbackProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called when the signal is noticed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies an argument passed to the specified procedure when it is called.
</p></td></tr></tbody></table></div><p>
The callback procedure pointers used to handle signal events are of type
<a class="xref" href="#XtSignalCallbackProc"><code class="function">(*XtSignalCallbackProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtSignalCallbackProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtSignalCallbackProc)</strong>(</code>XtPointer <var class="pdparam">client_data</var>, XtSignalId *<var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Passes the client data argument that was registered for this procedure in
<a class="xref" href="#XtAppAddSignal"><code class="function">XtAppAddSignal</code></a>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Passes the id returned from the corresponding
<a class="xref" href="#XtAppAddSignal"><code class="function">XtAppAddSignal</code></a>
call.
</p></td></tr></tbody></table></div><p>
To notify the Intrinsics that a signal has occured, use
<a class="xref" href="#XtNoticeSignal"><code class="function">XtNoticeSignal</code></a>.
</p><div class="funcsynopsis"><a id="XtNoticeSignal"></a><p><code class="funcdef">void <strong class="fsfunc">XtNoticeSignal</strong>(</code>XtSignalId <var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Specifies the id returned from the corresponding
<a class="xref" href="#XtAppAddSignal"><code class="function">XtAppAddSignal</code></a>
call.
</p></td></tr></tbody></table></div><p>
On a POSIX-based system,
<a class="xref" href="#XtNoticeSignal"><code class="function">XtNoticeSignal</code></a>
is the only Intrinsics function that can safely be called from a signal handler.
If
<a class="xref" href="#XtNoticeSignal"><code class="function">XtNoticeSignal</code></a>
is invoked multiple times before the Intrinsics are able to invoke the
registered callback, the callback is only called once.
Logically, the Intrinsics maintain ``pending'' flag for each registered callback.
This flag is initially
<code class="function">False</code>
and is set to
<code class="function">True</code>
by
<a class="xref" href="#XtNoticeSignal"><code class="function">XtNoticeSignal</code></a>.
When
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>
or
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>
(with a mask including
<code class="function">XtIMSignal</code>)
is called, all registered callbacks with ``pending''
<code class="function">True</code>
are invoked and the flags are reset to
<code class="function">False</code>.
</p><p>
If the signal handler wants to track how many times the signal has been
raised, it can keep its own private counter. Typically the handler would
not do any other work; the callback does the actual processing for the
signal. The Intrinsics never block signals from being raised, so if a given
signal can be raised multiple times before the Intrinsics can invoke the
callback for that signal, the callback must be designed to deal with
this. In another case, a signal might be raised just after the Intrinsics
sets the pending flag to
<code class="function">False</code>
but before the callback can get control, in which case the pending flag
will still be
<code class="function">True</code>
after the callback returns, and the Intrinsics will invoke the callback
again, even though all of the signal raises have been handled. The
callback must also be prepared to handle this case.
</p><p>
To remove a registered signal callback, call
<a class="xref" href="#XtRemoveSignal"><code class="function">XtRemoveSignal</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveSignal"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveSignal</strong>(</code>XtSignalId <var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Specifies the id returned by the corresponding call to
<a class="xref" href="#XtAppAddSignal"><code class="function">XtAppAddSignal</code></a>.
</p></td></tr></tbody></table></div><p>
The client should typically disable the source of the signal before calling
<a class="xref" href="#XtRemoveSignal"><code class="function">XtRemoveSignal</code></a>.
If the signal could have been raised again before the source was disabled
and the client wants to process it, then after disabling the source but
before calling
<a class="xref" href="#XtRemoveSignal"><code class="function">XtRemoveSignal</code></a>
the client can test for signals with
<a class="xref" href="#XtAppPending"><code class="function">XtAppPending</code></a>
and process them by calling
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>
with the mask
<code class="function">XtIMSignal</code>.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Constraining_Events_to_a_Cascade_of_Widgets"></a>Constraining Events to a Cascade of Widgets</h2></div></div></div><p>
Modal widgets are widgets that, except for the input directed to them,
lock out user input to the application.
</p><p>
When a modal menu or modal dialog box is popped up using
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>,
user events (keyboard and pointer events) that occur outside the modal
widget should be delivered to the modal widget or ignored.
In no case will user events be delivered to a widget outside
the modal widget.
</p><p>
Menus can pop up submenus, and dialog boxes can pop up further dialog
boxes to create a pop-up cascade.
In this case,
user events may be delivered to one of several modal widgets in the cascade.
</p><p>
Display-related events should be delivered outside the modal cascade so that
exposure events and the like keep the application's display up-to-date.
Any event that occurs within the cascade is delivered as usual.
The user events delivered to the most recent spring-loaded shell
in the cascade when they occur outside the cascade are called remap events
and are
<code class="function">KeyPress</code>,
<code class="function">KeyRelease</code>,
<code class="function">ButtonPress</code>,
and
<code class="function">ButtonRelease</code>.
The user events ignored when they occur outside the cascade are
<code class="function">MotionNotify</code>
and
<code class="function">EnterNotify</code>.
All other events are delivered normally.
In particular, note that this is one
way in which widgets can receive
<code class="function">LeaveNotify</code>
events without first receiving
<code class="function">EnterNotify</code>
events; they should be prepared to deal with
this, typically by ignoring any unmatched
<code class="function">LeaveNotify</code>
events.
</p><p>
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>
uses the
<a class="xref" href="#XtAddGrab"><code class="function">XtAddGrab</code></a>
and
<a class="xref" href="#XtRemoveGrab"><code class="function">XtRemoveGrab</code></a>
functions to constrain user events to a modal cascade
and subsequently to remove a grab when the modal widget is popped down.
</p><p>
To constrain or redirect user input to a modal widget, use
<a class="xref" href="#XtAddGrab"><code class="function">XtAddGrab</code></a>.
</p><div class="funcsynopsis"><a id="XtAddGrab"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddGrab</strong>(</code>Widget <var class="pdparam">w</var>, Boolean <var class="pdparam">exclusive</var>, Boolean <var class="pdparam">spring_loaded</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget to add to the modal cascade. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>exclusive</em></span>
</span></p></td><td><p>
Specifies whether user events should be dispatched exclusively to this widget
or also to previous widgets in the cascade.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>spring_loaded</em></span>
</span></p></td><td><p>
Specifies whether this widget was popped up because the user pressed
a pointer button.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAddGrab"><code class="function">XtAddGrab</code></a>
function appends the widget to the modal cascade
and checks that <span class="emphasis"><em>exclusive</em></span> is
<code class="function">True</code>
if <span class="emphasis"><em>spring_loaded</em></span> is
<code class="function">True</code>.
If this condition is not met,
<a class="xref" href="#XtAddGrab"><code class="function">XtAddGrab</code></a>
generates a warning message.
</p><p>
The modal cascade is used by
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
when it tries to dispatch a user event.
When at least one modal widget is in the widget cascade,
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
first determines if the event should be delivered.
It starts at the most recent cascade entry and follows the cascade up to and
including the most recent cascade entry added with the <span class="emphasis"><em>exclusive</em></span> parameter
<code class="function">True</code>.
</p><p>
This subset of the modal cascade along with all descendants of these widgets
comprise the active subset.
User events that occur outside the widgets in this subset are ignored
or remapped.
Modal menus with submenus generally add a submenu widget to the cascade
with <span class="emphasis"><em>exclusive</em></span>
<code class="function">False</code>.
Modal dialog boxes that need to restrict user input to the most deeply nested
dialog box add a subdialog widget to the cascade with <span class="emphasis"><em>exclusive</em></span>
<code class="function">True</code>.
User events that occur within the active subset are delivered to the
appropriate widget, which is usually a child or further descendant of the modal
widget.
</p><p>
Regardless of where in the application they occur,
remap events are always delivered to the most recent widget in the active
subset of the cascade registered with <span class="emphasis"><em>spring_loaded</em></span>
<code class="function">True</code>,
if any such widget exists.
If the event
occurred in the active subset of the cascade but outside the
spring-loaded widget, it is delivered normally before being
delivered also to the spring-loaded widget.
Regardless of where it is dispatched, the Intrinsics do not modify
the contents of the event.
</p><p>
To remove the redirection of user input to a modal widget, use
<a class="xref" href="#XtRemoveGrab"><code class="function">XtRemoveGrab</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveGrab"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveGrab</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget to remove from the modal cascade.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveGrab"><code class="function">XtRemoveGrab</code></a>
function removes widgets from the modal cascade starting
at the most recent widget up to and including the specified widget.
It issues a warning if the specified widget is not on the modal cascade.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Requesting_Key_and_Button_Grabs"></a>Requesting Key and Button Grabs</h3></div></div></div><p>
The Intrinsics provide a set of key and button grab interfaces that
are parallel to those provided by Xlib and that allow the Intrinsics
to modify event dispatching when necessary. X Toolkit applications and
widgets that need to passively grab keys or buttons or actively grab
the keyboard or pointer should use the
following Intrinsics routines rather than the corresponding Xlib
routines.
</p><p>
To passively grab a single key of the keyboard, use
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>.
</p><div class="funcsynopsis"><a id="XtGrabKey"></a><p><code class="funcdef">void <strong class="fsfunc">XtGrabKey</strong>(</code>Widget <var class="pdparam">widget</var>, KeyCode <var class="pdparam">keycode</var>, Modifiers <var class="pdparam">modifiers</var>, Boolean <var class="pdparam">owner_events</var>, int <var class="pdparam">pointer_mode</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget in whose window the key is to be grabbed. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keycode</em></span>
, </span><span class="term">
<span class="emphasis"><em>modifiers</em></span>
, </span><span class="term">
<span class="emphasis"><em>owner_events</em></span>
, </span><span class="term">
<span class="emphasis"><em>pointer_mode</em></span>
, </span><span class="term">
<span class="emphasis"><em>keyboard_mode</em></span>
</span></p></td><td><p>
Specify arguments to
<code class="function">XGrabKey</code>;
see <span class="olink">Section 12.2</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
calls
<code class="function">XGrabKey</code>
specifying the widget's window as the grab
window if the widget is realized. The remaining arguments are exactly
as for
<code class="function">XGrabKey</code>.
If the widget is not realized, or is later unrealized, the call to
<code class="function">XGrabKey</code>
is performed (again) when
the widget is realized and its window becomes mapped. In the future,
if
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
is called with a
<code class="function">KeyPress</code>
event matching the specified keycode and modifiers (which may be
<code class="function">AnyKey</code>
or
<code class="function">AnyModifier</code>,
respectively) for the
widget's window, the Intrinsics will call
<a class="xref" href="#XtUngrabKeyboard"><code class="function">XtUngrabKeyboard</code></a>
with the timestamp from the
<code class="function">KeyPress</code>
event if either of the following conditions is true:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
There is a modal cascade and the widget is not in
the active subset of the cascade and the keyboard was not previously
grabbed, or
</p></li><li class="listitem"><p>
<code class="function">XFilterEvent</code>
returns
<code class="function">True</code>.
</p></li></ul></div><p>
To cancel a passive key grab, use
<a class="xref" href="#XtUngrabKey"><code class="function">XtUngrabKey</code></a>.
</p><div class="funcsynopsis"><a id="XtUngrabKey"></a><p><code class="funcdef">void <strong class="fsfunc">XtUngrabKey</strong>(</code>Widget <var class="pdparam">widget</var>, KeyCode <var class="pdparam">keycode</var>, Modifiers <var class="pdparam">modifiers</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget in whose window the key was grabbed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keycode</em></span>
, </span><span class="term">
<span class="emphasis"><em>modifiers</em></span>
</span></p></td><td><p>
Specify arguments to
<code class="function">XUngrabKey</code>;
see <span class="olink">Section 12.2</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtUngrabKey"><code class="function">XtUngrabKey</code></a>
procedure calls
<code class="function">XUngrabKey</code>
specifying the widget's
window as the ungrab window if the widget is realized. The remaining
arguments are exactly as for
<code class="function">XUngrabKey</code>.
If the widget is not realized,
<a class="xref" href="#XtUngrabKey"><code class="function">XtUngrabKey</code></a>
removes a deferred
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
request, if any, for the specified widget, keycode, and modifiers.
</p><p>
To actively grab the keyboard, use
<a class="xref" href="#XtGrabKeyboard"><code class="function">XtGrabKeyboard</code></a>.
</p><div class="funcsynopsis"><a id="XtGrabKeyboard"></a><p><code class="funcdef">int <strong class="fsfunc">XtGrabKeyboard</strong>(</code>Widget <var class="pdparam">widget</var>, Boolean <var class="pdparam">owner_events</var>, int <var class="pdparam">pointer_mode</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget for whose window the keyboard is to be grabbed.
Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>owner_events</em></span>
, </span><span class="term">
<span class="emphasis"><em>pointer_mode</em></span>
, </span><span class="term">
<span class="emphasis"><em>keyboard_mode</em></span>
, </span><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specify arguments to
<code class="function">XGrabKeyboard</code>;
see <span class="olink">Section 12.2</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
If the specified widget is realized,
<a class="xref" href="#XtGrabKeyboard"><code class="function">XtGrabKeyboard</code></a>
calls
<code class="function">XGrabKeyboard</code>
specifying the widget's window as the grab window. The remaining
arguments and return value are exactly as for
<code class="function">XGrabKeyboard</code>.
If the widget is not realized,
<a class="xref" href="#XtGrabKeyboard"><code class="function">XtGrabKeyboard</code></a>
immediately returns
<code class="function">GrabNotViewable</code>.
No future automatic ungrab is implied by
<a class="xref" href="#XtGrabKeyboard"><code class="function">XtGrabKeyboard</code></a>.
</p><p>
To cancel an active keyboard grab, use
<a class="xref" href="#XtUngrabKeyboard"><code class="function">XtUngrabKeyboard</code></a>.
</p><div class="funcsynopsis"><a id="XtUngrabKeyboard"></a><p><code class="funcdef">void <strong class="fsfunc">XtUngrabKeyboard</strong>(</code>Widget <var class="pdparam">widget</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget that has the active keyboard grab.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the additional argument to
<code class="function">XUngrabKeyboard</code>;
see <span class="olink">Section 12.2</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtUngrabKeyboard"><code class="function">XtUngrabKeyboard</code></a>
calls
<code class="function">XUngrabKeyboard</code>
with the specified time.
</p><p>
To passively grab a single pointer button, use
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>.
</p><div class="funcsynopsis"><a id="XtGrabButton"></a><p><code class="funcdef">void <strong class="fsfunc">XtGrabButton</strong>(</code>Widget <var class="pdparam">widget</var>, int <var class="pdparam">button</var>, Modifiers <var class="pdparam">modifiers</var>, Boolean <var class="pdparam">owner_events</var>, unsigned int <var class="pdparam">event_mask</var>, int <var class="pdparam">pointer_mode</var>, Window <var class="pdparam">confine_to</var>, Cursor <var class="pdparam">cursor</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget in whose window the button is to be grabbed. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>button</em></span>
, </span><span class="term">
<span class="emphasis"><em>modifiers</em></span>
, </span><span class="term">
<span class="emphasis"><em>owner_events</em></span>
, </span><span class="term">
<span class="emphasis"><em>event_mask</em></span>
, </span><span class="term">
<span class="emphasis"><em>pointer_mode</em></span>
, </span><span class="term">
<span class="emphasis"><em>keyboard_mode</em></span>
, </span><span class="term">
<span class="emphasis"><em>confine_to</em></span>
, </span><span class="term">
<span class="emphasis"><em>cursor</em></span>
</span></p></td><td><p>
Specify arguments to
<code class="function">XGrabButton</code>;
see <span class="olink">Section 12.1</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>
calls
<code class="function">XGrabButton</code>
specifying the widget's window as the
grab window if the widget is realized. The remaining arguments are
exactly as for
<code class="function">XGrabButton</code>.
If the widget is not realized, or is later unrealized, the call to
<code class="function">XGrabButton</code>
is performed (again)
when the widget is realized and its window becomes mapped. In the
future, if
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
is called with a
<code class="function">ButtonPress</code>
event matching the specified button and modifiers (which may be
<code class="function">AnyButton</code>
or
<code class="function">AnyModifier</code>,
respectively)
for the widget's window, the Intrinsics will call
<a class="xref" href="#XtUngrabPointer"><code class="function">XtUngrabPointer</code></a>
with the timestamp from the
<code class="function">ButtonPress</code>
event if either of the following conditions is true:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
There is a modal cascade and the
widget is not in the active subset of the cascade and the pointer was
not previously grabbed, or
</p></li><li class="listitem"><p>
<code class="function">XFilterEvent</code>
returns
<code class="function">True</code>.
</p></li></ul></div><p>
To cancel a passive button grab, use
<a class="xref" href="#XtUngrabButton"><code class="function">XtUngrabButton</code></a>.
</p><div class="funcsynopsis"><a id="XtUngrabButton"></a><p><code class="funcdef">void <strong class="fsfunc">XtUngrabButton</strong>(</code>Widget <var class="pdparam">widget</var>, unsigned int <var class="pdparam">button</var>, Modifiers <var class="pdparam">modifiers</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget in whose window the button was grabbed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>button</em></span>
, </span><span class="term">
<span class="emphasis"><em>modifiers</em></span>
</span></p></td><td><p>
Specify arguments to
<code class="function">XUngrabButton</code>;
see <span class="olink">Section 12.1</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtUngrabButton"><code class="function">XtUngrabButton</code></a>
procedure calls
<code class="function">XUngrabButton</code>
specifying the
widget's window as the ungrab window if the widget is realized. The
remaining arguments are exactly as for
<code class="function">XUngrabButton</code>.
If the widget is not realized,
<a class="xref" href="#XtUngrabButton"><code class="function">XtUngrabButton</code></a>
removes a deferred
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>
request, if any, for the specified widget, button, and modifiers.
</p><p>
To actively grab the pointer, use
<a class="xref" href="#XtGrabPointer"><code class="function">XtGrabPointer</code></a>.
</p><div class="funcsynopsis"><a id="XtGrabPointer"></a><p><code class="funcdef">int <strong class="fsfunc">XtGrabPointer</strong>(</code>Widget <var class="pdparam">widget</var>, Boolean <var class="pdparam">owner_events</var>, unsigned int <var class="pdparam">event_mask</var>, int <var class="pdparam">pointer_mode</var>, Window <var class="pdparam">confine_to</var>, Cursor <var class="pdparam">cursor</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget for whose window the pointer is to be grabbed. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>owner_events</em></span>
, </span><span class="term">
<span class="emphasis"><em>event_mask</em></span>
, </span><span class="term">
<span class="emphasis"><em>pointer_mode</em></span>
, </span><span class="term">
<span class="emphasis"><em>keyboard_mode</em></span>
, </span><span class="term">
<span class="emphasis"><em>confine_to</em></span>
, </span><span class="term">
<span class="emphasis"><em>cursor</em></span>
, </span><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specify arguments to
<code class="function">XGrabPointer</code>;
see <span class="olink">Section 12.1</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
If the specified widget is realized,
<a class="xref" href="#XtGrabPointer"><code class="function">XtGrabPointer</code></a>
calls
<code class="function">XGrabPointer</code>,
specifying the widget's window as the grab window. The remaining
arguments and return value are exactly as for
<code class="function">XGrabPointer</code>.
If the widget is not realized,
<a class="xref" href="#XtGrabPointer"><code class="function">XtGrabPointer</code></a>
immediately returns
<code class="function">GrabNotViewable</code>.
No future automatic ungrab is implied by
<a class="xref" href="#XtGrabPointer"><code class="function">XtGrabPointer</code></a>.
</p><p>
To cancel an active pointer grab, use
<a class="xref" href="#XtUngrabPointer"><code class="function">XtUngrabPointer</code></a>.
</p><div class="funcsynopsis"><a id="XtUngrabPointer"></a><p><code class="funcdef">void <strong class="fsfunc">XtUngrabPointer</strong>(</code>Widget <var class="pdparam">widget</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget that has the active pointer grab.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the time argument to
<code class="function">XUngrabPointer</code>;
see <span class="olink">Section 12.1</span>
in <span class="olink">Xlib — C Language X Interface</span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtUngrabPointer"><code class="function">XtUngrabPointer</code></a>
calls
<code class="function">XUngrabPointer</code>
with the specified time.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Focusing_Events_on_a_Child"></a>Focusing Events on a Child</h2></div></div></div><p>
To redirect keyboard input to a normal descendant of a
widget without calling
<code class="function">XSetInputFocus</code>,
use
<a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>.
</p><div class="funcsynopsis"><a id="XtSetKeyboardFocus"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetKeyboardFocus</strong>(</code>Widget <var class="pdparam">subtree</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>subtree</em></span>
</span></p></td><td><p>
Specifies the subtree of the hierarchy for which the keyboard focus is
to be set. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>descendant</em></span>
</span></p></td><td><p>
Specifies either the normal (non-pop-up) descendant of <span class="emphasis"><em>subtree</em></span> to which
keyboard events are logically directed, or
<code class="function">None</code>.
It is not an error to specify
<code class="function">None</code>
when no input focus was previously set. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>
causes
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
to remap keyboard events occurring within the specified subtree
and dispatch them to the specified descendant widget or to an ancestor.
If the descendant's class is not a subclass of Core, the descendant is
replaced by its closest windowed ancestor.
</p><p>
When there is no modal cascade, keyboard events can be dispatched
to a widget in one of five ways. Assume the server delivered the
event to the window for widget E (because of X input focus, key or
keyboard grabs, or pointer position).
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
If neither E nor any of E's ancestors have redirected the keyboard
focus, or if the event activated a grab for E as specified by a call
to
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
with any value of <span class="emphasis"><em>owner_events</em></span>, or
if the keyboard is actively grabbed by E with <span class="emphasis"><em>owner_events</em></span>
<code class="function">False</code>
via
<a class="xref" href="#XtGrabKeyboard"><code class="function">XtGrabKeyboard</code></a>
or
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
on a previous key press, the event is dispatched to E.
</p></li><li class="listitem"><p>
Beginning with the ancestor of E closest to the root that has
redirected the keyboard focus or E if no such ancestor exists, if
the target of that focus redirection has in turn redirected the
keyboard focus, recursively follow this focus chain to find a widget
F that has not redirected focus.
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
If E is the final focus target widget F or a descendant of F, the
event is dispatched to E.
</p></li><li class="listitem"><p>
If E is not F, an ancestor of F, or a descendant of F, and the event
activated a grab for E as specified by a call to
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
for E,
<a class="xref" href="#XtUngrabKeyboard"><code class="function">XtUngrabKeyboard</code></a>
is called.
</p></li><li class="listitem"><p>
If E is an ancestor of F, and the event is a key press, and either
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: square; "><li class="listitem"><p>
E has grabbed the key with
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
and <span class="emphasis"><em>owner_events</em></span>
<code class="function">False</code>,
or
</p></li><li class="listitem"><p>
E has grabbed the key with
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
and <span class="emphasis"><em>owner_events</em></span>
<code class="function">True</code>,
and the coordinates of the event are outside the rectangle specified
by E's geometry,
then the event is dispatched to E.
</p></li></ul></div></li><li class="listitem"><p>
Otherwise, define A as the closest common ancestor of E and F:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: square; "><li class="listitem"><p>
If there is an active keyboard grab for any widget via either
<a class="xref" href="#XtGrabKeyboard"><code class="function">XtGrabKeyboard</code></a>
or
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
on a previous key press, or
if no widget between F and A (noninclusive) has grabbed
the key and modifier combination with
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
and any value of <span class="emphasis"><em>owner_events</em></span>, the event is dispatched to F.
</p></li><li class="listitem"><p>
Else, the event is dispatched to the ancestor of F closest to A
that has grabbed the key and modifier combination with
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>.
</p></li></ul></div></li></ul></div></li></ul></div><p>
When there is a modal cascade, if the final destination widget as
identified above is in the active subset of the cascade, the event is
dispatched; otherwise the event is remapped to a spring-loaded shell
or discarded.
Regardless of where it is dispatched, the Intrinsics do not modify
the contents of the event.
</p><p>
When <span class="emphasis"><em>subtree</em></span> or one of its descendants acquires the X input focus
or the pointer moves into the subtree such that keyboard events would
now be delivered to the subtree, a
<code class="function">FocusIn</code>
event is generated for the descendant if
<code class="function">FocusChange</code>
events have been selected by the descendant.
Similarly, when <span class="emphasis"><em>subtree</em></span> loses the X input focus
or the keyboard focus for one of its ancestors, a
<code class="function">FocusOut</code>
event is generated for descendant if
<code class="function">FocusChange</code>
events have been selected by the descendant.
</p><p>
A widget tree may also actively manage the X server input focus. To
do so, a widget class specifies an accept_focus procedure.
</p><p>
The accept_focus procedure pointer is of type
<a class="xref" href="#XtAcceptFocusProc"><code class="function">*XtAcceptFocusProc</code></a>.
</p><div class="funcsynopsis"><a id="XtAcceptFocusProc"></a><p><code class="funcdef">Boolean <strong class="fsfunc">*XtAcceptFocusProc</strong>(</code>Widget <var class="pdparam">w</var>, Time *<var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the X time of the event causing the accept focus.
</p></td></tr></tbody></table></div><p>
Widgets that need the input focus can call
<code class="function">XSetInputFocus</code>
explicitly, pursuant to the restrictions of the <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span>.
To allow outside agents, such as the parent,
to cause a widget to take the input focus,
every widget exports an accept_focus procedure.
The widget returns a value indicating
whether it actually took the focus or not,
so that the parent can give the focus to another widget.
Widgets that need to know when they lose the input focus must use
the Xlib focus notification mechanism explicitly
(typically by specifying translations for
<code class="function">FocusIn</code>
and
<code class="function">FocusOut</code>
events).
Widgets classes that never want the input focus should set the
<span class="emphasis"><em>accept_focus</em></span> field to NULL.
</p><p>
To call a widget's accept_focus procedure, use
<a class="xref" href="#XtCallAcceptFocus"><code class="function">XtCallAcceptFocus</code></a>.
</p><div class="funcsynopsis"><a id="XtCallAcceptFocus"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtCallAcceptFocus</strong>(</code>Widget <var class="pdparam">w</var>, Time *<var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the X time of the event that is causing the focus change.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCallAcceptFocus"><code class="function">XtCallAcceptFocus</code></a>
function calls the specified widget's accept_focus procedure,
passing it the specified widget and time, and returns what the accept_focus
procedure returns.
If <span class="emphasis"><em>accept_focus</em></span> is NULL,
<a class="xref" href="#XtCallAcceptFocus"><code class="function">XtCallAcceptFocus</code></a>
returns
<code class="function">False</code>.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Events_for_Drawables_That_Are_Not_a_Widget_s_Window"></a>Events for Drawables That Are Not a Widget's Window</h3></div></div></div><p>
Sometimes an application must handle events for drawables that are not
associated with widgets in its widget tree. Examples include handling
<code class="function">GraphicsExpose</code>
and
<code class="function">NoExpose</code>
events on Pixmaps, and handling
<code class="function">PropertyNotify</code>
events on the root window.
</p><p>
To register a drawable with the Intrinsics event dispatching, use
<a class="xref" href="#XtRegisterDrawable"><code class="function">XtRegisterDrawable</code></a>.
</p><div class="funcsynopsis"><a id="XtRegisterDrawable"></a><p><code class="funcdef">void <strong class="fsfunc">XtRegisterDrawable</strong>(</code>Display *<var class="pdparam">display</var>, Drawable <var class="pdparam">drawable</var>, Widget <var class="pdparam">widget</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the drawable's display.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>drawable</em></span>
</span></p></td><td><p>
Specifies the drawable to register.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget to register the drawable for.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtRegisterDrawable"><code class="function">XtRegisterDrawable</code></a>
associates the specified drawable with the specified widget
so that future calls to
<a class="xref" href="#XtWindowToWidget"><code class="function">XtWindowToWidget</code></a>
with the drawable will return the widget.
The default event dispatcher will dispatch future events that
arrive for the drawable to the widget in the same manner as
events that contain the widget's window.
</p><p>
If the drawable is already registered with another widget, or if the
drawable is the window of a widget in the client's widget tree, the
results of calling
<a class="xref" href="#XtRegisterDrawable"><code class="function">XtRegisterDrawable</code></a>
are undefined.
</p><p>
To unregister a drawable with the Intrinsics event dispatching, use
<a class="xref" href="#XtUnregisterDrawable"><code class="function">XtUnregisterDrawable</code></a>.
</p><div class="funcsynopsis"><a id="XtUnregisterDrawable"></a><p><code class="funcdef">void <strong class="fsfunc">XtUnregisterDrawable</strong>(</code>Display *<var class="pdparam">display</var>, Drawable <var class="pdparam">drawable</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the drawable's display.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>drawable</em></span>
</span></p></td><td><p>
Specifies the drawable to unregister.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtUnregisterDrawable"><code class="function">XtUnregisterDrawable</code></a>
removes an association created with
<a class="xref" href="#XtRegisterDrawable"><code class="function">XtRegisterDrawable</code></a>.
If the drawable is the window of a widget in the client's widget tree
the results of calling
<a class="xref" href="#XtUnregisterDrawable"><code class="function">XtUnregisterDrawable</code></a>
are undefined.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Querying_Event_Sources"></a>Querying Event Sources</h2></div></div></div><p>
The event manager provides several functions to examine and read events
(including file and timer events) that are in the queue.
The next three functions are Intrinsics equivalents of the
<code class="function">XPending</code>,
<code class="function">XPeekEvent</code>,
and
<code class="function">XNextEvent</code>
Xlib calls.
</p><p>
To determine if there are any events on the input queue for a given application,
use
<a class="xref" href="#XtAppPending"><code class="function">XtAppPending</code></a>.
</p><div class="funcsynopsis"><a id="XtAppPending"></a><p><code class="funcdef">XtInputMask <strong class="fsfunc">XtAppPending</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application to check.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppPending"><code class="function">XtAppPending</code></a>
function returns a nonzero value if there are
events pending from the X server, timer pending, other input sources
pending, or signal sources pending. The
value returned is a bit mask that is the OR of
<code class="function">XtIMXEvent</code>,
<code class="function">XtIMTimer</code>,
<code class="function">XtIMAlternateInput</code>,
and
<code class="function">XtIMSignal</code>
(see
<code class="function">XtAppProcessEvent ).</code>
If there are no events pending,
<a class="xref" href="#XtAppPending"><code class="function">XtAppPending</code></a>
flushes the output buffers of each Display in the application context
and returns zero.
</p><p>
To return the event from the head of a given application's input queue
without removing input from the queue, use
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>.
</p><div class="funcsynopsis"><a id="XtAppPeekEvent"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtAppPeekEvent</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XEvent *<var class="pdparam">event_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_return</em></span>
</span></p></td><td><p>
Returns the event information to the specified event structure.
</p></td></tr></tbody></table></div><p>
If there is an X event in the queue,
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>
copies it into <span class="emphasis"><em>event_return</em></span> and returns
<code class="function">True</code>.
If no X input is on the queue,
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>
flushes the output buffers of each Display in the application context
and blocks until some input is available
(possibly calling some timeout callbacks in the interim).
If the next available input is an X event,
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>
fills in <span class="emphasis"><em>event_return</em></span> and returns
<code class="function">True</code>.
Otherwise, the input is for an input source
registered with
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>,
and
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>
returns
<code class="function">False</code>.
The sample implementations provides XtAppPeekEvent as described. Timeout callbacks
are called while blocking for input. If some input for an input source is
available,
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>
will return
<code class="function">True</code>
without returning an event.
</p><p>
To remove and return the event
from the head of a given application's X event queue,
use
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>.
</p><div class="funcsynopsis"><a id="XtAppNextEvent"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppNextEvent</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XEvent *<var class="pdparam">event_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_return</em></span>
</span></p></td><td><p>
Returns the event information to the specified event structure.
</p></td></tr></tbody></table></div><p>
If the X event queue is empty,
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>
flushes the X output buffers of each Display in the application context
and waits for an X event while looking at the other input sources
and timeout values and calling any callback procedures triggered by them.
This wait time can be used for background processing;
see <a class="xref" href="#Adding_Background_Work_Procedures" title="Adding Background Work Procedures">the section called “Adding Background Work Procedures”</a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Dispatching_Events"></a>Dispatching Events</h2></div></div></div><p>
The Intrinsics provide functions that dispatch events
to widgets or other application code.
Every client interested in X events on a widget uses
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
to register which events it is
interested in and a procedure (event handler) to be called
when the event happens in that window.
The translation manager automatically registers event handlers for widgets
that use translation tables; see <a class="xref" href="#Translation_Management" title="Chapter 10. Translation Management">Chapter 10, <em>Translation Management</em></a>.
</p><p>
Applications that need direct control of the processing of different types
of input should use
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>.
</p><div class="funcsynopsis"><a id="XtAppProcessEvent"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppProcessEvent</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtInputMask <var class="pdparam">mask</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the
application for which to process input.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>mask</em></span>
</span></p></td><td><p>
Specifies what types of events to process.
The mask is the bitwise inclusive OR of any combination of
<code class="function">XtIMXEvent</code>,
<code class="function">XtIMTimer</code>,
<code class="function">XtIMAlternateInput</code>,
and
<code class="function">XtIMSignal</code>.
As a convenience,
<code class="function">Intrinsic.h</code>
defines the symbolic name
<code class="function">XtIMAll</code>
to be the bitwise inclusive OR of these four event types.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>
function processes one timer, input source, signal source, or X event.
If there is no event or input of the appropriate type to process, then
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>
blocks until there is.
If there is more than one type of input available to process,
it is undefined which will get processed.
Usually, this procedure is not called by client applications; see
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>.
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>
processes timer events by calling any appropriate timer callbacks,
input sources by calling any appropriate input callbacks,
signal source by calling any appropriate signal callbacks,
and X events by
calling
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>.
</p><p>
When an X event is received,
it is passed to
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>,
which calls the appropriate event handlers
and passes them the widget, the event, and client-specific data
registered with each procedure.
If no handlers for that event are registered,
the event is ignored and the dispatcher simply returns.
</p><p>
To dispatch an event returned by
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>,
retrieved directly from the Xlib queue, or synthetically constructed,
to any registered event filters or event handlers, call
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>.
</p><div class="funcsynopsis"><a id="XtDispatchEvent"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtDispatchEvent</strong>(</code>XEvent *<var class="pdparam">event</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies a pointer to the event structure to be dispatched
to the appropriate event handlers.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
function first calls
<code class="function">XFilterEvent</code>
with the <span class="emphasis"><em>event</em></span> and the window of the widget to which the
Intrinsics intend to dispatch the event, or the event window if
the Intrinsics would not dispatch the event to any handlers.
If
<code class="function">XFilterEvent</code>
returns
<code class="function">True</code>
and the event activated a server grab as identified
by a previous call to
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
or
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>,
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
calls
<a class="xref" href="#XtUngrabKeyboard"><code class="function">XtUngrabKeyboard</code></a>
or
<a class="xref" href="#XtUngrabPointer"><code class="function">XtUngrabPointer</code></a>
with the timestamp from the event and immediately returns
<code class="function">True</code>.
If
<code class="function">XFilterEvent</code>
returns
<code class="function">True</code>
and a grab was not activated,
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
just immediately returns
<code class="function">True</code>.
Otherwise,
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
sends the event to the event handler functions that
have been previously registered with the dispatch routine.
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
returns
<code class="function">True</code>
if
<code class="function">XFilterEvent</code>
returned
<code class="function">True</code>,
or if the event was dispatched to some handler, and
<code class="function">False</code>
if it found no handler to which to dispatch the event.
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
records the last timestamp in any event that
contains a timestamp (see
<code class="function">XtLastTimestampProcessed ),</code>
regardless of whether it was filtered or dispatched.
If a modal cascade is active with <span class="emphasis"><em>spring_loaded</em></span>
<code class="function">True</code>,
and if the event is a remap event as defined by
<a class="xref" href="#XtAddGrab"><code class="function">XtAddGrab</code></a>,
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
may dispatch the event a second time. If it does so,
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
will call
<code class="function">XFilterEvent</code>
again with the window of the spring-loaded widget prior to the second
dispatch, and if
<code class="function">XFilterEvent</code>
returns
<code class="function">True</code>,
the second dispatch will not be performed.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="The_Application_Input_Loop"></a>The Application Input Loop</h2></div></div></div><p>
To process all input from a given application in a continuous loop,
use the convenience procedure
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>.
</p><div class="funcsynopsis"><a id="XtAppMainLoop"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppMainLoop</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>
function first reads the next incoming X event by calling
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>
and then dispatches the event to the appropriate registered procedure
by calling
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>.
This constitutes the main loop of X Toolkit applications.
There is nothing special about
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>;
it simply calls
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>
and then
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
in a conditional loop.
At the bottom of the loop, it checks to see if the specified
application context's destroy flag is set.
If the flag is set, the loop breaks.
The whole loop is enclosed between a matching
<a class="xref" href="#XtAppLock"><code class="function">XtAppLock</code></a>
and
<a class="xref" href="#XtAppUnlock"><code class="function">XtAppUnlock</code></a>.
</p><p>
Applications can provide their own version of this loop,
which tests some global termination flag or tests that the number
of top-level widgets is larger than zero before circling back to the call to
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Setting_and_Checking_the_Sensitivity_State_of_a_Widget"></a>Setting and Checking the Sensitivity State of a Widget</h2></div></div></div><p>
Many widgets have a mode in which they assume a different appearance
(for example, are grayed out or stippled), do not respond to user events,
and become dormant.
</p><p>
When dormant,
a widget is considered to be insensitive.
If a widget is insensitive,
the event manager does not dispatch any events to the widget
with an event type of
<code class="function">KeyPress</code>,
<code class="function">KeyRelease</code>,
<code class="function">ButtonPress</code>,
<code class="function">ButtonRelease</code>,
<code class="function">MotionNotify</code>,
<code class="function">EnterNotify</code>,
<code class="function">LeaveNotify</code>,
<code class="function">FocusIn</code>,
or
<code class="function">FocusOut</code>.
</p><p>
A widget can be insensitive because its <span class="emphasis"><em>sensitive</em></span> field is
<code class="function">False</code>
or because one of its ancestors is insensitive and thus the widget's
<span class="emphasis"><em>ancestor_sensitive</em></span> field also is
<code class="function">False</code>.
A widget can but does not need to distinguish these two cases visually.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
Pop-up shells will have
<span class="emphasis"><em>ancestor_sensitive</em></span>
<code class="function">False</code>
if the parent was insensitive when the shell
was created. Since
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
on the parent will not
modify the resource of the pop-up child, clients are advised to include
a resource specification of the form
``*TransientShell.ancestorSensitive: True''
in the application defaults resource file or to
otherwise ensure that the parent is
sensitive when creating pop-up shells.
</p></div><p>
To set the sensitivity state of a widget, use
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>.
</p><div class="funcsynopsis"><a id="XtSetSensitive"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetSensitive</strong>(</code>Widget <var class="pdparam">w</var>, Boolean <var class="pdparam">sensitive</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>sensitive</em></span>
</span></p></td><td><p>
Specifies whether the widget should receive
keyboard, pointer, and focus events.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
function first calls
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
on the current widget with an argument list specifying the
XtNsensitive resource and the new value.
If <span class="emphasis"><em>sensitive</em></span> is
<code class="function">False</code>
and the widget's class is a subclass of
Composite,
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
recursively propagates the new value
down the child tree by calling
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
on each child to set <span class="emphasis"><em>ancestor_sensitive</em></span> to
<code class="function">False</code>.
If <span class="emphasis"><em>sensitive</em></span> is
<code class="function">True</code>
and the widget's class is a subclass of
Composite
and the widget's <span class="emphasis"><em>ancestor_sensitive</em></span> field is
<code class="function">True</code>,
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
sets the <span class="emphasis"><em>ancestor_sensitive</em></span> of each child to
<code class="function">True</code>
and then recursively calls
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
on each normal descendant that is now sensitive to set
<span class="emphasis"><em>ancestor_sensitive</em></span> to
<code class="function">True</code>.
</p><p>
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
calls
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
to change the <span class="emphasis"><em>sensitive</em></span> and <span class="emphasis"><em>ancestor_sensitive</em></span> fields
of each affected widget.
Therefore, when one of these changes,
the widget's set_values procedure should
take whatever display actions are needed
(for example, graying out or stippling the widget).
</p><p>
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
maintains the invariant that, if the parent has either <span class="emphasis"><em>sensitive</em></span>
or <span class="emphasis"><em>ancestor_sensitive</em></span>
<code class="function">False</code>,
then all children have <span class="emphasis"><em>ancestor_sensitive</em></span>
<code class="function">False</code>.
</p><p>
To check the current sensitivity state of a widget,
use
<a class="xref" href="#XtIsSensitive"><code class="function">XtIsSensitive</code></a>.
</p><div class="funcsynopsis"><a id="XtIsSensitive"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtIsSensitive</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the object. Must be of class Object or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtIsSensitive"><code class="function">XtIsSensitive</code></a>
function returns
<code class="function">True</code>
or
<code class="function">False</code>
to indicate whether user input events are being dispatched.
If object's class is a subclass of RectObj and
both <span class="emphasis"><em>sensitive</em></span> and <span class="emphasis"><em>ancestor_sensitive</em></span> are
<code class="function">True</code>,
<a class="xref" href="#XtIsSensitive"><code class="function">XtIsSensitive</code></a>
returns
<code class="function">True</code>;
otherwise, it returns
<code class="function">False</code>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Adding_Background_Work_Procedures"></a>Adding Background Work Procedures</h2></div></div></div><p>
The Intrinsics have some limited support for background processing.
Because most applications spend most of their time waiting for input,
you can register an idle-time work procedure
that is called when the toolkit would otherwise block in
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>
or
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>.
Work procedure pointers are of type
<a class="xref" href="#XtWorkProc"><code class="function">(*XtWorkProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtWorkProc"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtWorkProc)</strong>(</code>XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Passes the client data specified when the work procedure was registered.
</p></td></tr></tbody></table></div><p>
This procedure should return
<code class="function">True</code>
when it is done to indicate that it
should be removed.
If the procedure returns
<code class="function">False</code>,
it will remain registered and called again when the
application is next idle.
Work procedures should be very judicious about how much they do.
If they run for more than a small part of a second,
interactive feel is likely to suffer.
</p><p>
To register a work procedure for a given application, use
<a class="xref" href="#XtAppAddWorkProc"><code class="function">XtAppAddWorkProc</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddWorkProc"></a><p><code class="funcdef">XtWorkProcId <strong class="fsfunc">XtAppAddWorkProc</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtWorkProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that identifies the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called when the application is idle.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the argument passed to the specified procedure
when it is called.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppAddWorkProc"><code class="function">XtAppAddWorkProc</code></a>
function adds the specified work procedure for the application identified
by <span class="emphasis"><em>app_context</em></span>
and returns an opaque unique identifier for this work procedure.
Multiple work procedures can be registered,
and the most recently added one is always the one that is called.
However, if a work procedure adds another work procedure,
the newly added one has lower priority than the current one.
</p><p>
To remove a work procedure, either return
<code class="function">True</code>
from the procedure when it is called or use
<a class="xref" href="#XtRemoveWorkProc"><code class="function">XtRemoveWorkProc</code></a>
outside of the procedure.
</p><div class="funcsynopsis"><a id="XtRemoveWorkProc"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveWorkProc</strong>(</code>XtWorkProcId <var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Specifies which work procedure to remove.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveWorkProc"><code class="function">XtRemoveWorkProc</code></a>
function explicitly removes the specified background work procedure.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="X_Event_Filters"></a>X Event Filters</h2></div></div></div><p>
The event manager provides filters that can be applied to
specific X events.
The filters, which screen out events that are redundant or are temporarily
unwanted, handle
pointer motion compression,
enter/leave compression, and
exposure compression.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Pointer_Motion_Compression"></a>Pointer Motion Compression</h3></div></div></div><p>
Widgets can have a hard time keeping up with a rapid stream of
pointer motion events. Furthermore,
they usually do not care about every motion event. To throw out
redundant motion events, the widget class field <span class="emphasis"><em>compress_motion</em></span> should be
<code class="function">True</code>.
When a request for an event would return a motion event,
the Intrinsics check if there are any other motion events
for the same widget immediately
following the current one and, if so, skip all but the last of them.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Enter_Leave_Compression"></a>Enter/Leave Compression</h3></div></div></div><p>
To throw out pairs of enter and leave events that have no intervening events,
as can happen when the user moves the pointer across a widget
without stopping in it,
the widget class field <span class="emphasis"><em>compress_enterleave</em></span> should be
<code class="function">True</code>.
These enter and leave events are not delivered to the client
if they are found together in the input queue.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Exposure_Compression"></a>Exposure Compression</h3></div></div></div><p>
Many widgets prefer to process a series of exposure events as a
single expose region rather than as individual rectangles. Widgets
with complex displays might use the expose region as a clip list
in a graphics context, and widgets with simple displays might
ignore the region entirely and redisplay their whole window or
might get the bounding box from the region and redisplay only that
rectangle.
</p><p>
In either case, these widgets do not care about getting partial exposure events.
The <span class="emphasis"><em>compress_exposure</em></span> field in the widget class
structure specifies the type and number of exposure events that are
dispatched to the widget's expose procedure. This field must be
initialized to one of the following values:
</p><div class="literallayout"><p><br />
#define XtExposeNoCompress ((XtEnum)False)<br />
#define XtExposeCompressSeries ((XtEnum)True)<br />
#define XtExposeCompressMultiple <implementation-defined><br />
#define XtExposeCompressMaximal <implementation-defined><br />
</p></div><p>
optionally ORed with any combination of the following flags (all with
implementation-defined values):
<code class="function">XtExposeGraphicsExpose</code>,
<code class="function">XtExposeGraphicsExposeMerged</code>,
<code class="function">XtExposeNoExpose</code>,
and
<code class="function">XtExposeNoRegion</code>.
</p><p>
If the <span class="emphasis"><em>compress_exposure</em></span> field in the widget class structure does not
specify
<code class="function">XtExposeNoCompress</code>,
the event manager calls the widget's expose procedure only
once for a series of exposure events.
In this case, all
<code class="function">Expose</code>
or
<code class="function">GraphicsExpose</code>
events are accumulated into a region.
When the final event is received,
the event manager replaces the rectangle in the event with the
bounding box for the region
and calls the widget's expose procedure,
passing the modified exposure event and (unless
<code class="function">XtExposeNoRegion</code>
is specified) the region.
For more information on regions, see
<span class="olink">Section 16.5</span> in
<span class="olink">Xlib — C Language X Interface.</span>.)
</p><p>
The values have the following interpretation:
</p><p>
<code class="function">XtExposeNoCompress</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
No exposure compression is performed; every selected event is
individually dispatched to the expose procedure with a <span class="emphasis"><em>region</em></span>
argument of NULL.
</p></li></ul></div><p>
<code class="function">XtExposeCompressSeries</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Each series of exposure events is coalesced into a single event,
which is dispatched
when an exposure event with count equal to zero is reached.
</p></li></ul></div><p>
<code class="function">XtExposeCompressMultiple</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Consecutive series of exposure events are coalesced into a single
event, which is dispatched
when an exposure event with count equal to zero is reached and either
the event queue is empty or the next event is not an exposure event
for the same widget.
</p></li></ul></div><p>
<code class="function">XtExposeCompressMaximal</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
All expose series currently in the queue for the widget
are coalesced into a single
event without regard to intervening nonexposure events. If a
partial series is in the end of the queue, the Intrinsics will
block until the end of the series is received.
</p></li></ul></div><p>
The additional flags have the following meaning:
</p><p>
<code class="function">XtExposeGraphicsExpose</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Specifies that
<code class="function">GraphicsExpose</code>
events are also to be dispatched to
the expose procedure.
<code class="function">GraphicsExpose</code>
events are compressed, if specified, in the same manner as
<code class="function">Expose</code>
events.
</p></li></ul></div><p>
<code class="function">XtExposeGraphicsExposeMerged</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Specifies in the case of
<code class="function">XtExposeCompressMultiple</code>
and
<code class="function">XtExposeCompressMaximal</code>
that series of
<code class="function">GraphicsExpose</code>
and
<code class="function">Expose</code>
events are to be compressed together, with the final event type
determining the type of the event passed to the expose procedure.
If this flag is not set, then only series of the same event type
as the event at the head of the queue are coalesced. This flag
also implies
<code class="function">XtExposeGraphicsExpose</code>.
</p></li></ul></div><p>
<code class="function">XtExposeNoExpose</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Specifies that
<code class="function">NoExpose</code>
events are also to be dispatched to the expose procedure.
<code class="function">NoExpose</code>
events are never coalesced with
other exposure events or with each other.
</p></li></ul></div><p>
<code class="function">XtExposeNoRegion</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Specifies that the final region argument passed to the expose
procedure is NULL. The rectangle in the event will still
contain bounding box information for the entire series of
compressed exposure events. This option saves processing time when the
region is not needed by the widget.
</p></li></ul></div></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Widget_Exposure_and_Visibility"></a>Widget Exposure and Visibility</h2></div></div></div><p>
Every primitive widget and some composite widgets display data on the screen
by means of direct Xlib calls.
Widgets cannot simply write to the screen and forget what they have done.
They must keep enough state to redisplay the window or parts
of it if a portion is obscured and then reexposed.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Redisplay_of_a_Widget_The_expose_Procedure"></a>Redisplay of a Widget: The expose Procedure</h3></div></div></div><p>
The expose procedure pointer in a widget class is of type
<a class="xref" href="#XtExposeProc"><code class="function">(*XtExposeProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtExposeProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtExposeProc)</strong>(</code>Widget <var class="pdparam">w</var>, XEvent *<var class="pdparam">event</var>, Region <var class="pdparam">region</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget instance requiring redisplay.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies the exposure event giving the rectangle requiring redisplay.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>region</em></span>
</span></p></td><td><p>
Specifies the union of all rectangles in this exposure sequence.
</p></td></tr></tbody></table></div><p>
The redisplay of a widget upon exposure is the responsibility of the
expose procedure in the widget's class record.
If a widget has no display semantics,
it can specify NULL for the <span class="emphasis"><em>expose</em></span> field.
Many composite widgets serve only as containers for their children
and have no expose procedure.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
If the <span class="emphasis"><em>expose</em></span> procedure is NULL,
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
fills in a default bit gravity of
<code class="function">NorthWestGravity</code>
before it calls the widget's realize procedure.
</p></div><p>
If the widget's <span class="emphasis"><em>compress_exposure</em></span> class field specifies
<code class="function">XtExposeNoCompress</code>
or
<code class="function">XtExposeNoRegion</code>,
or if the event type is
<code class="function">NoExpose</code>
(see <a class="xref" href="#Exposure_Compression" title="Exposure Compression">the section called “Exposure Compression”</a>),
<span class="emphasis"><em>region</em></span> is NULL. If
<code class="function">XtExposeNoCompress</code>
is not specified and the event type is not
<code class="function">NoExpose</code>,
the event is the final event in the compressed series
but <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>, <span class="emphasis"><em>width</em></span>, and <span class="emphasis"><em>height</em></span> contain
the bounding box for all the compressed events.
The region is created and destroyed by the Intrinsics, but
the widget is permitted to modify the region contents.
</p><p>
A small simple widget (for example, Label) can ignore the bounding box
information in the event and redisplay the entire window.
A more complicated widget (for example, Text) can use the bounding box
information to minimize the amount of calculation and redisplay it does.
A very complex widget uses the region as a clip list in a GC and
ignores the event information.
The expose procedure is not chained and is therefore
responsible for exposure of all superclass data
as well as its own.
</p><p>
However,
it often is possible to anticipate the display needs of several levels
of subclassing.
For example, rather than implement separate display procedures for
the widgets Label, Pushbutton, and Toggle,
you could write a single display routine in Label that uses display state
fields like
</p><div class="literallayout"><p><br />
Boolean invert;<br />
Boolean highlight;<br />
Dimension highlight_width;<br />
</p></div><p>
Label would have <span class="emphasis"><em>invert</em></span> and <span class="emphasis"><em>highlight</em></span> always
<code class="function">False</code>
and <span class="emphasis"><em>highlight_width</em></span> zero.
Pushbutton would dynamically set <span class="emphasis"><em>highlight</em></span> and <span class="emphasis"><em>highlight_width</em></span>,
but it would leave <span class="emphasis"><em>invert</em></span> always
<code class="function">False</code>.
Finally, Toggle would dynamically set all three.
In this case,
the expose procedures for Pushbutton and Toggle inherit
their superclass's expose procedure;
see <a class="xref" href="#Inheritance_of_Superclass_Operations" title="Inheritance of Superclass Operations">the section called “Inheritance of Superclass Operations”</a>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Visibility"></a>Widget Visibility</h3></div></div></div><p>
Some widgets may use substantial computing resources to produce the
data they will display.
However, this effort is wasted if the widget is not actually visible
on the screen, that is, if the widget is obscured by another application
or is iconified.
</p><p>
The <span class="emphasis"><em>visible</em></span> field in the
core
widget structure provides a hint to the widget that it need not compute
display data.
This field is guaranteed to be
<code class="function">True</code>
by the time an
exposure
event is processed if any part of the widget is visible,
but is
<code class="function">False</code>
if the widget is fully obscured.
</p><p>
Widgets can use or ignore the <span class="emphasis"><em>visible</em></span> hint.
If they ignore it,
they should have <span class="emphasis"><em>visible_interest</em></span> in their widget class record set
<code class="function">False</code>.
In such cases,
the <span class="emphasis"><em>visible</em></span> field is initialized
<code class="function">True</code>
and never changes.
If <span class="emphasis"><em>visible_interest</em></span> is
<code class="function">True</code>,
the event manager asks for
<code class="function">VisibilityNotify</code>
events for the widget and sets <span class="emphasis"><em>visible</em></span> to
<code class="function">True</code>
on
<code class="function">VisibilityUnobscured</code>
or
<code class="function">VisibilityPartiallyObscured</code>
events and
<code class="function">False</code>
on
<code class="function">VisibilityFullyObscured</code>
events.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="X_Event_Handlers"></a>X Event Handlers</h2></div></div></div><p>
Event handlers are procedures called when specified events
occur in a widget.
Most widgets need not use event handlers explicitly.
Instead, they use the Intrinsics translation manager.
Event handler procedure pointers are of the type
<a class="xref" href="#XtEventHandler"><code class="function">(*XtEventHandler)</code></a>.
</p><div class="funcsynopsis"><a id="XtEventHandler"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtEventHandler)</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, XEvent *<var class="pdparam">event</var>, Boolean *<var class="pdparam">continue_to_dispatch</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which the event arrived.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies any client-specific information registered with the event handler.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies the triggering event.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>continue_to_dispatch</em></span>
</span></p></td><td><p>
Specifies whether the remaining event
handlers registered for the current event
should be called.
</p></td></tr></tbody></table></div><p>
After receiving an event and before calling any event handlers, the
Boolean pointed to by <span class="emphasis"><em>continue_to_dispatch</em></span> is initialized to
<code class="function">True</code>.
When an event handler is called, it may decide that further processing
of the event is not desirable and may store
<code class="function">False</code>
in this Boolean, in
which case any handlers remaining to be called for the event are
ignored.
</p><p>
The circumstances under which the Intrinsics may add event handlers
to a widget are currently implementation-dependent. Clients must
therefore be aware that storing
<code class="function">False</code>
into the <span class="emphasis"><em>continue_to_dispatch</em></span> argument can lead to portability problems.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Event_Handlers_That_Select_Events"></a>Event Handlers That Select Events</h3></div></div></div><p>
To register an event handler procedure with the dispatch mechanism, use
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtAddEventHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddEventHandler</strong>(</code>Widget <var class="pdparam">w</var>, EventMask <var class="pdparam">event_mask</var>, Boolean <var class="pdparam">nonmaskable</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_mask</em></span>
</span></p></td><td><p>
Specifies the event mask for which to call this procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nonmaskable</em></span>
</span></p></td><td><p>
Specifies whether this procedure should be
called on the nonmaskable events
<code class="function">( GraphicsExpose</code>,
<code class="function">NoExpose</code>,
<code class="function">SelectionClear</code>,
<code class="function">SelectionRequest</code>,
<code class="function">SelectionNotify</code>,
<code class="function">ClientMessage</code>,
and
<code class="function">MappingNotify ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the event handler.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
function registers a procedure with the dispatch mechanism that is
to be called when an event that matches the mask occurs on the specified
widget.
Each widget has a single registered event handler list, which will
contain any procedure/client_data pair exactly once regardless of
the manner in which it is registered.
If the procedure is already registered with the same <span class="emphasis"><em>client_data</em></span>
value,
the specified mask augments the existing mask.
If the widget is realized,
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
calls
<code class="function">XSelectInput</code>,
if necessary.
The order in which this procedure is called relative to other handlers
registered for the same event is not defined.
</p><p>
To remove a previously registered event handler, use
<a class="xref" href="#XtRemoveEventHandler"><code class="function">XtRemoveEventHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveEventHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveEventHandler</strong>(</code>Widget <var class="pdparam">w</var>, EventMask <var class="pdparam">event_mask</var>, Boolean <var class="pdparam">nonmaskable</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which this procedure is registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_mask</em></span>
</span></p></td><td><p>
Specifies the event mask for which to unregister this procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nonmaskable</em></span>
</span></p></td><td><p>
Specifies whether this procedure should be
removed on the nonmaskable events
<code class="function">( GraphicsExpose</code>,
<code class="function">NoExpose</code>,
<code class="function">SelectionClear</code>,
<code class="function">SelectionRequest</code>,
<code class="function">SelectionNotify</code>,
<code class="function">ClientMessage</code>,
and
<code class="function">MappingNotify ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be removed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the registered client data.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveEventHandler"><code class="function">XtRemoveEventHandler</code></a>
function unregisters an event handler registered with
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
or
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>
for the specified events.
The request is ignored if <span class="emphasis"><em>client_data</em></span> does not match the value given
when the handler was registered.
If the widget is realized and no other event handler requires the event,
<a class="xref" href="#XtRemoveEventHandler"><code class="function">XtRemoveEventHandler</code></a>
calls
<code class="function">XSelectInput</code>.
If the specified procedure has not been registered
or if it has been registered with a different value of <span class="emphasis"><em>client_data</em></span>,
<a class="xref" href="#XtRemoveEventHandler"><code class="function">XtRemoveEventHandler</code></a>
returns without reporting an error.
</p><p>
To stop a procedure registered with
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
or
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>
from receiving all selected events, call
<a class="xref" href="#XtRemoveEventHandler"><code class="function">XtRemoveEventHandler</code></a>
with an <span class="emphasis"><em>event_mask</em></span> of
<code class="function">XtAllEvents</code>
and <span class="emphasis"><em>nonmaskable</em></span>
<code class="function">True</code>.
The procedure will continue to receive any events
that have been specified in calls to
<a class="xref" href="#XtAddRawEventHandler"><code class="function">XtAddRawEventHandler</code></a>
or
<a class="xref" href="#XtInsertRawEventHandler"><code class="function">XtInsertRawEventHandler</code></a>.
</p><p>
To register an event handler procedure that receives events before or
after all previously registered event handlers, use
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>.
</p><div class="literallayout"><p><br />
typedef enum {XtListHead, XtListTail} XtListPosition;<br />
</p></div><div class="funcsynopsis"><a id="XtInsertEventHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtInsertEventHandler</strong>(</code>Widget <var class="pdparam">w</var>, EventMask <var class="pdparam">event_mask</var>, Boolean <var class="pdparam">nonmaskable</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var>, XtListPosition <var class="pdparam">position</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_mask</em></span>
</span></p></td><td><p>
Specifies the event mask for which to call this procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nonmaskable</em></span>
</span></p></td><td><p>
Specifies whether this procedure should be
called on the nonmaskable events
<code class="function">( GraphicsExpose</code>,
<code class="function">NoExpose</code>,
<code class="function">SelectionClear</code>,
<code class="function">SelectionRequest</code>,
<code class="function">SelectionNotify</code>,
<code class="function">ClientMessage</code>,
and
<code class="function">MappingNotify ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the client's event handler.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>position</em></span>
</span></p></td><td><p>
Specifies when the event handler is to be called
relative to other previously registered handlers.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>
is identical to
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
with the additional <span class="emphasis"><em>position</em></span> argument. If <span class="emphasis"><em>position</em></span> is
<code class="function">XtListHead</code>,
the event
handler is registered so that it is called before any event
handlers that were previously registered for the same widget. If
<span class="emphasis"><em>position</em></span> is
<code class="function">XtListTail</code>,
the event handler is registered to be called
after any previously registered event handlers. If the procedure is
already registered with the same <span class="emphasis"><em>client_data</em></span> value, the specified mask
augments the existing mask and the procedure is repositioned in
the list.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Event_Handlers_That_Do_Not_Select_Events"></a>Event Handlers That Do Not Select Events</h3></div></div></div><p>
On occasion,
clients need to register an event handler procedure with the
dispatch mechanism without explicitly
causing the X server to select for that event.
To do this, use
<a class="xref" href="#XtAddRawEventHandler"><code class="function">XtAddRawEventHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtAddRawEventHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddRawEventHandler</strong>(</code>Widget <var class="pdparam">w</var>, EventMask <var class="pdparam">event_mask</var>, Boolean <var class="pdparam">nonmaskable</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_mask</em></span>
</span></p></td><td><p>
Specifies the event mask for which to call this procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nonmaskable</em></span>
</span></p></td><td><p>
Specifies whether this procedure should be
called on the nonmaskable events
<code class="function">( GraphicsExpose</code>,
<code class="function">NoExpose</code>,
<code class="function">SelectionClear</code>,
<code class="function">SelectionRequest</code>,
<code class="function">SelectionNotify</code>,
<code class="function">ClientMessage</code>,
and
<code class="function">MappingNotify ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the client's event handler.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAddRawEventHandler"><code class="function">XtAddRawEventHandler</code></a>
function is similar to
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
except that it does not affect the widget's event mask and never causes an
<code class="function">XSelectInput</code>
for its events.
Note that the widget might already have those mask bits set
because of other nonraw event handlers registered on it.
If the procedure is already registered with the same <span class="emphasis"><em>client_data</em></span>,
the specified mask augments the existing mask.
The order in which this procedure is called relative to other handlers
registered for the same event is not defined.
</p><p>
To remove a previously registered raw event handler, use
<a class="xref" href="#XtRemoveRawEventHandler"><code class="function">XtRemoveRawEventHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveRawEventHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveRawEventHandler</strong>(</code>Widget <var class="pdparam">w</var>, EventMask <var class="pdparam">event_mask</var>, Boolean <var class="pdparam">nonmaskable</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which this procedure is registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_mask</em></span>
</span></p></td><td><p>
Specifies the event mask for which to unregister this procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nonmaskable</em></span>
</span></p></td><td><p>
Specifies whether this procedure should be
removed on the nonmaskable events
<code class="function">( GraphicsExpose</code>,
<code class="function">NoExpose</code>,
<code class="function">SelectionClear</code>,
<code class="function">SelectionRequest</code>,
<code class="function">SelectionNotify</code>,
<code class="function">ClientMessage</code>,
and
<code class="function">MappingNotify ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be registered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the registered client data.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveRawEventHandler"><code class="function">XtRemoveRawEventHandler</code></a>
function unregisters an event handler registered with
<a class="xref" href="#XtAddRawEventHandler"><code class="function">XtAddRawEventHandler</code></a>
or
<a class="xref" href="#XtInsertRawEventHandler"><code class="function">XtInsertRawEventHandler</code></a>
for the specified events without changing
the window event mask.
The request is ignored if <span class="emphasis"><em>client_data</em></span> does not match the value given
when the handler was registered.
If the specified procedure has not been registered
or if it has been registered with a different value of <span class="emphasis"><em>client_data</em></span>,
<a class="xref" href="#XtRemoveRawEventHandler"><code class="function">XtRemoveRawEventHandler</code></a>
returns without reporting an error.
</p><p>
To stop a procedure
registered with
<a class="xref" href="#XtAddRawEventHandler"><code class="function">XtAddRawEventHandler</code></a>
or
<a class="xref" href="#XtInsertRawEventHandler"><code class="function">XtInsertRawEventHandler</code></a>
from receiving all nonselected events, call
<a class="xref" href="#XtRemoveRawEventHandler"><code class="function">XtRemoveRawEventHandler</code></a>
with an <span class="emphasis"><em>event_mask</em></span> of
<code class="function">XtAllEvents</code>
and <span class="emphasis"><em>nonmaskable</em></span>
<code class="function">True</code>.
The procedure
will continue to receive any events that have been specified in calls to
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
or
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>.
</p><p>
To register an event handler procedure that receives events before or
after all previously registered event handlers without selecting for
the events, use
<a class="xref" href="#XtInsertRawEventHandler"><code class="function">XtInsertRawEventHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtInsertRawEventHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtInsertRawEventHandler</strong>(</code>Widget <var class="pdparam">w</var>, EventMask <var class="pdparam">event_mask</var>, Boolean <var class="pdparam">nonmaskable</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var>, XtListPosition <var class="pdparam">position</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_mask</em></span>
</span></p></td><td><p>
Specifies the event mask for which to call this procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nonmaskable</em></span>
</span></p></td><td><p>
Specifies whether this procedure should be
called on the nonmaskable events
<code class="function">( GraphicsExpose</code>,
<code class="function">NoExpose</code>,
<code class="function">SelectionClear</code>,
<code class="function">SelectionRequest</code>,
<code class="function">SelectionNotify</code>,
<code class="function">ClientMessage</code>,
and
<code class="function">MappingNotify ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be registered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the client's event handler.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>position</em></span>
</span></p></td><td><p>
Specifies when the event handler is to be called
relative to other previously registered handlers.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtInsertRawEventHandler"><code class="function">XtInsertRawEventHandler</code></a>
function is similar to
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>
except that it does not modify the widget's event
mask and never causes an
<code class="function">XSelectInput</code>
for the specified events. If
the procedure is already registered with the same <span class="emphasis"><em>client_data</em></span>
value, the
specified mask augments the existing mask and the procedure is
repositioned in the list.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Current_Event_Mask"></a>Current Event Mask</h3></div></div></div><p>
To retrieve the event mask for a given widget, use
<a class="xref" href="#XtBuildEventMask"><code class="function">XtBuildEventMask</code></a>.
</p><div class="funcsynopsis"><a id="XtBuildEventMask"></a><p><code class="funcdef">EventMask <strong class="fsfunc">XtBuildEventMask</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtBuildEventMask"><code class="function">XtBuildEventMask</code></a>
function returns the event mask representing the logical OR
of all event masks for event handlers registered on the widget with
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>
and
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>
and all event translations, including accelerators,
installed on the widget.
This is the same event mask stored into the
<code class="function">XSetWindowAttributes</code>
structure by
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>
and sent to the server when event handlers and translations are installed or
removed on the realized widget.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Event_Handlers_for_X_Protocol_Extensions"></a>Event Handlers for X11 Protocol Extensions</h3></div></div></div><p>
To register an event handler procedure with the Intrinsics dispatch
mechanism according to an event type, use
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtInsertEventTypeHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtInsertEventTypeHandler</strong>(</code>Widget <var class="pdparam">widget</var>, int <var class="pdparam">event_type</var>, XtPointer <var class="pdparam">select_data</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var>, XtListPosition <var class="pdparam">position</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget for which this event handler is being registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_type</em></span>
</span></p></td><td><p>
Specifies the event type for which to call this event handler.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>select_data</em></span>
</span></p></td><td><p>
Specifies data used to request events of the specified type from the server,
or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the event handler to be called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the event handler.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>position</em></span>
</span></p></td><td><p>
Specifies when the event handler is to be called relative to other
previously registered handlers.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>
registers a procedure with the
dispatch mechanism that is to be called when an event that matches the
specified <span class="emphasis"><em>event_type</em></span> is dispatched to the specified <span class="emphasis"><em>widget</em></span>.
</p><p>
If <span class="emphasis"><em>event_type</em></span> specifies one of the core X protocol events, then
<span class="emphasis"><em>select_data</em></span> must be a pointer to a value of type
<code class="function">EventMask</code>,
indicating
the event mask to be used to select for the desired event. This event
mask is included in the value returned by
<a class="xref" href="#XtBuildEventMask"><code class="function">XtBuildEventMask</code></a>.
If the widget is realized,
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>
calls
<code class="function">XSelectInput</code>
if necessary. Specifying NULL for <span class="emphasis"><em>select_data</em></span> is equivalent to
specifying a pointer to an event mask containing 0. This is similar
to the
<a class="xref" href="#XtInsertRawEventHandler"><code class="function">XtInsertRawEventHandler</code></a>
function.
</p><p>
If <span class="emphasis"><em>event_type</em></span> specifies an extension event type, then the semantics of
the data pointed to by <span class="emphasis"><em>select_data</em></span> are defined by the extension
selector registered for the specified event type.
</p><p>
In either case the Intrinsics are not required to copy the data
pointed to by <span class="emphasis"><em>select_data</em></span>, so the caller must ensure that it remains
valid as long as the event handler remains registered with this value
of <span class="emphasis"><em>select_data</em></span>.
</p><p>
The <span class="emphasis"><em>position</em></span> argument allows the client to control the order of
invocation of event handlers registered for the same event type. If
the client does not care about the order, it should normally specify
<code class="function">XtListTail</code>,
which registers this event handler after any previously
registered handlers for this event type.
</p><p>
Each widget has a single registered event handler list, which will
contain any procedure/client_data pair exactly once if it is
registered with
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>,
regardless of the manner
in which it is registered and regardless of the value(s)
of <span class="emphasis"><em>select_data</em></span>. If the procedure is already registered with the
same <span class="emphasis"><em>client_data</em></span> value, the specified mask augments the existing
mask and the procedure is repositioned in the list.
</p><p>
To remove an event handler registered with
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>,
use
<a class="xref" href="#XtRemoveEventTypeHandler"><code class="function">XtRemoveEventTypeHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveEventTypeHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveEventTypeHandler</strong>(</code>Widget <var class="pdparam">widget</var>, int <var class="pdparam">event_type</var>, XtPointer <var class="pdparam">select_data</var>, XtEventHandler <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget for which the event handler was registered. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_type</em></span>
</span></p></td><td><p>
Specifies the event type for which the handler was registered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>select_data</em></span>
</span></p></td><td><p>
Specifies data used to deselect events of the specified type
from the server, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the event handler to be removed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the additional client data with which the procedure was registered.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveEventTypeHandler"><code class="function">XtRemoveEventTypeHandler</code></a>
function unregisters an event handler
registered with
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>
for the specified event type.
The request is ignored if <span class="emphasis"><em>client_data</em></span> does not match the value given
when the handler was registered.
</p><p>
If <span class="emphasis"><em>event_type</em></span> specifies one of the core X protocol events,
<span class="emphasis"><em>select_data</em></span> must be a pointer to a value of type
<code class="function">EventMask, indicating the event</code>
mask to be used to deselect for the appropriate event. If the widget
is realized,
<a class="xref" href="#XtRemoveEventTypeHandler"><code class="function">XtRemoveEventTypeHandler</code></a>
calls
<code class="function">XSelectInput</code>
if necessary.
Specifying NULL for <span class="emphasis"><em>select_data</em></span> is equivalent to specifying a pointer
to an event mask containing 0. This is similar to the
<a class="xref" href="#XtRemoveRawEventHandler"><code class="function">XtRemoveRawEventHandler</code></a>
function.
</p><p>
If <span class="emphasis"><em>event_type</em></span> specifies an extension event type, then the semantics of
the data pointed to by <span class="emphasis"><em>select_data</em></span> are defined by the extension
selector registered for the specified event type.
</p><p>
To register a procedure to select extension events for a widget, use
<a class="xref" href="#XtRegisterExtensionSelector"><code class="function">XtRegisterExtensionSelector</code></a>.
</p><div class="funcsynopsis"><a id="XtRegisterExtensionSelector"></a><p><code class="funcdef">void <strong class="fsfunc">XtRegisterExtensionSelector</strong>(</code>Display <var class="pdparam">*display</var>, int <var class="pdparam">min_event_type</var>, int <var class="pdparam">max_event_type</var>, XtExtensionSelectProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display for which the extension selector is to be registered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>min_event_type</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>max_event_type</em></span>
</span></p></td><td><p>
Specifies the range of event types for the extension.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the extension selector procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the extension selector.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRegisterExtensionSelector"><code class="function">XtRegisterExtensionSelector</code></a>
function registers a procedure to arrange
for the delivery of extension events to widgets.
</p><p>
If <span class="emphasis"><em>min_event_type</em></span> and <span class="emphasis"><em>max_event_type</em></span> match the parameters
to a previous call to
<a class="xref" href="#XtRegisterExtensionSelector"><code class="function">XtRegisterExtensionSelector</code></a>
for the same <span class="emphasis"><em>display</em></span>, then <span class="emphasis"><em>proc</em></span> and <span class="emphasis"><em>client_data</em></span>
replace the previously
registered values. If the range specified by <span class="emphasis"><em>min_event_type</em></span>
and <span class="emphasis"><em>max_event_type</em></span> overlaps the range of the parameters to a
previous call for the same display in any other way, an error results.
</p><p>
When a widget is realized,
after the <span class="emphasis"><em>core.realize</em></span> method is called,
the Intrinsics check to see if any event
handler specifies an event type within the range of a registered
extension selector. If so, the Intrinsics call each such selector.
If an event type handler is added or removed, the Intrinsics check to
see if the event type falls within the range of a registered extension
selector, and if it does, calls the selector. In either case the Intrinsics
pass a list of all the widget's event types that are within the
selector's range. The corresponding select data are also passed. The
selector is responsible for enabling the delivery of extension events
required by the widget.
</p><p>
An extension selector is of type
<a class="xref" href="#XtExtensionSelectProc"><code class="function">(*XtExtensionSelectProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtExtensionSelectProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtExtensionSelectProc)</strong>(</code>Widget <var class="pdparam">widget</var>, int *<var class="pdparam">event_types</var>, XtPointer *<var class="pdparam">select_data</var>, int <var class="pdparam">count</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget that is being realized or is having
an event handler added or removed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_types</em></span>
</span></p></td><td><p>
Specifies a list of event types that the widget has
registered event handlers for.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>select_data</em></span>
</span></p></td><td><p>
Specifies a list of the select_data parameters specified in
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>count</em></span>
</span></p></td><td><p>
Specifies the number of entries in the <span class="emphasis"><em>event_types</em></span> and <span class="emphasis"><em>select_data</em></span>
lists.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the additional client data with which the procedure was registered.
</p></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>event_types</em></span> and <span class="emphasis"><em>select_data</em></span> lists will always have the
same number of elements, specified by <span class="emphasis"><em>count</em></span>.
Each event type/select data pair represents one call to
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>.
</p><p>
To register a procedure to dispatch events of a specific type within
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>,
use
<a class="xref" href="#XtSetEventDispatcher"><code class="function">XtSetEventDispatcher</code></a>.
</p><div class="funcsynopsis"><a id="XtSetEventDispatcher"></a><p><code class="funcdef">XtEventDispatchProc <strong class="fsfunc">XtSetEventDispatcher</strong>(</code>Display *<var class="pdparam">display</var>, int <var class="pdparam">event_type</var>, XtEventDispatchProc <var class="pdparam">proc</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display for which the event dispatcher is to be registered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_type</em></span>
</span></p></td><td><p>
Specifies the event type for which the dispatcher should be invoked.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the event dispatcher procedure.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtSetEventDispatcher"><code class="function">XtSetEventDispatcher</code></a>
function registers the event dispatcher procedure specified by <span class="emphasis"><em>proc</em></span>
for events with the type <span class="emphasis"><em>event_type</em></span>. The previously registered
dispatcher (or the default dispatcher if there was no previously registered
dispatcher) is returned. If <span class="emphasis"><em>proc</em></span> is NULL, the default procedure is
restored for the specified type.
</p><p>
In the future, when
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
is called with an event type of <span class="emphasis"><em>event_type</em></span>, the specified <span class="emphasis"><em>proc</em></span>
(or the default dispatcher) is invoked to determine a widget
to which to dispatch the event.
</p><p>
The default dispatcher handles the Intrinsics modal cascade and keyboard
focus mechanisms, handles the semantics of <span class="emphasis"><em>compress_enterleave</em></span>
and <span class="emphasis"><em>compress_motion</em></span>, and discards all extension events.
</p><p>
An event dispatcher procedure pointer is of type
<a class="xref" href="#XtEventDispatchProc"><code class="function">(*XtEventDispatchProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtEventDispatchProc"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtEventDispatchProc)</strong>(</code>XEvent *<var class="pdparam">event</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Passes the event to be dispatched.
</p></td></tr></tbody></table></div><p>
The event dispatcher procedure should determine whether this event is of
a type that should be dispatched to a widget.
</p><p>
If the event should be dispatched to a widget, the event dispatcher
procedure should determine the appropriate widget to receive the
event, call
<code class="function">XFilterEvent</code>
with the window of this widget, or
<code class="function">None</code>
if the event is to be discarded, and if
<code class="function">XFilterEvent</code>
returns
<code class="function">False</code>,
dispatch the event to the widget using
<a class="xref" href="#XtDispatchEventToWidget"><code class="function">XtDispatchEventToWidget</code></a>.
The procedure should return
<code class="function">True</code>
if either
<code class="function">XFilterEvent</code>
or
<a class="xref" href="#XtDispatchEventToWidget"><code class="function">XtDispatchEventToWidget</code></a>
returned
<code class="function">True</code>
and
<code class="function">False</code>
otherwise.
</p><p>
If the event should not be dispatched to a widget, the event
dispatcher procedure should attempt to dispatch the event elsewhere as
appropriate and return
<code class="function">True</code>
if it successfully dispatched the event and
<code class="function">False</code>
otherwise.
</p><p>
Some dispatchers for extension events may wish to forward events
according to the Intrinsics' keyboard focus mechanism. To determine
which widget is the end result of keyboard event forwarding, use
<a class="xref" href="#XtGetKeyboardFocusWidget"><code class="function">XtGetKeyboardFocusWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtGetKeyboardFocusWidget"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtGetKeyboardFocusWidget</strong>(</code>Widget <var class="pdparam">widget</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget to get forwarding information for.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetKeyboardFocusWidget"><code class="function">XtGetKeyboardFocusWidget</code></a>
function returns the widget that would be the end result of keyboard
event forwarding for a keyboard event for the specified widget.
</p><p>
To dispatch an event to a specified widget, use
<a class="xref" href="#XtDispatchEventToWidget"><code class="function">XtDispatchEventToWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtDispatchEventToWidget"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtDispatchEventToWidget</strong>(</code>Widget <var class="pdparam">widget</var>, XEvent *<var class="pdparam">event</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget to which to dispatch the event.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies a pointer to the event to be dispatched.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDispatchEventToWidget"><code class="function">XtDispatchEventToWidget</code></a>
function scans the list of registered event handlers for the
specified widget and calls each handler that has been registered
for the specified event type, subject to the <span class="emphasis"><em>continue_to_dispatch</em></span>
value returned by each handler.
The Intrinsics behave as if event handlers were registered at the head
of the list for
<code class="function">Expose</code>,
<code class="function">NoExpose</code>,
<code class="function">GraphicsExpose</code>,
and
<code class="function">VisibilityNotify</code>
events to invoke the widget's expose procedure according to the exposure
compression rules and to update the widget's <span class="emphasis"><em>visible</em></span> field
if <span class="emphasis"><em>visible_interest</em></span> is
<code class="function">True</code>.
These internal event handlers never set <span class="emphasis"><em>continue_to_dispatch</em></span> to
<code class="function">False</code>.
</p><p>
<a class="xref" href="#XtDispatchEventToWidget"><code class="function">XtDispatchEventToWidget</code></a>
returns
<code class="function">True</code>
if any event handler was called and
<code class="function">False</code>
otherwise.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Using_the_Intrinsics_in_a_Multi_Threaded_Environment"></a>Using the Intrinsics in a Multi-Threaded Environment</h2></div></div></div><p>
The Intrinsics may be used in environments that offer multiple threads
of execution within the context of a single process. A multi-threaded
application using the Intrinsics must explicitly initialize the toolkit
for mutually exclusive access by calling
<a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a>.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Initializing_a_Multi_Threaded_Intrinsics_Application"></a>Initializing a Multi-Threaded Intrinsics Application</h3></div></div></div><p>
To test and initialize Intrinsics support for mutually exclusive thread
access, call
<a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a>.
</p><div class="funcsynopsis"><a id="XtToolkitThreadInitialize"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtToolkitThreadInitialize</strong>(</code><var class="pdparam"></var><code>)</code>;</p></div><p>
<a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a>
returns <code class="function">True</code> if the Intrinsics support mutually exclusive thread
access, otherwise it returns <code class="function">False</code>. <a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a>
must be called before
<a class="xref" href="#XtCreateApplicationContext"><code class="function">XtCreateApplicationContext</code></a>,
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>,
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>,
or
<code class="function">XtSetLanguageProc</code>
is called. <a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a> may be called more than once;
however, the application writer must ensure that it is not called
simultaneously by two or more threads.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Locking_tk_Data_Structures"></a>Locking X Toolkit Data Structures</h3></div></div></div><p>
The Intrinsics employs two levels of locking: application context and
process. Locking an application context ensures mutually exclusive
access by a thread to the state associated with the application context,
including all displays and widgets associated with it. Locking a
process ensures mutually exclusive access by a thread to Intrinsics process
global data.
</p><p>
A client may acquire a lock multiple times and the effect is cumulative.
The client must ensure that the lock is released an equal number of times in
order for the lock to be acquired by another thread.
</p><p>
Most application writers will have little need to use locking as the
Intrinsics performs the necessary locking internally.
Resource converters are an exception.
They require the application context or process to be locked
before the application can safely call them directly, for example:
</p><div class="literallayout"><p><br />
...<br />
XtAppLock(app_context);<br />
XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret);<br />
XtAppUnlock(app_context);<br />
...<br />
</p></div><p>
When the application relies upon
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>
or a converter to provide the storage for the results of a
conversion, the application should acquire the process lock before
calling out and hold the lock until the results have been copied.
</p><p>
Application writers who write their own
utility functions, such as one which retrieves the being_destroyed field from
a widget instance, must lock the application context before accessing
widget internal data. For example:
</p><div class="literallayout"><p><br />
#include <X11/CoreP.h><br />
Boolean BeingDestroyed (widget)<br />
Widget widget;<br />
{<br />
Boolean ret;<br />
XtAppLock(XtWidgetToApplicationContext(widget));<br />
ret = widget->core.being_destroyed;<br />
XtAppUnlock(XtWidgetToApplicationContext(widget));<br />
return ret;<br />
}<br />
</p></div><p>
A client that wishes to atomically call two or more Intrinsics functions
must lock the application context. For example:
</p><div class="literallayout"><p><br />
...<br />
XtAppLock(XtWidgetToApplicationContext(widget));<br />
XtUnmanageChild (widget1);<br />
XtManageChild (widget2);<br />
XtAppUnlock(XtWidgetToApplicationContext(widget));<br />
...<br />
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Locking_the_Application_Context"></a>Locking the Application Context</h4></div></div></div><p>
To ensure mutual exclusion of application context, display, or
widget internal state, use
<code class="function">XtAppLock.</code>
</p><div class="funcsynopsis"><a id="XtAppLock"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppLock</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context to lock.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppLock"><code class="function">XtAppLock</code></a> blocks until it is able to acquire the lock. Locking the
application context also ensures that only the thread holding the lock
makes Xlib calls from within Xt. An application that makes its own
direct Xlib calls must either lock the application context around every
call or enable thread locking in Xlib.
</p><p>
To unlock a locked application context, use
<code class="function">XtAppUnlock.</code>
</p><div class="funcsynopsis"><a id="XtAppUnlock"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppUnlock</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context that was previously locked.
</p></td></tr></tbody></table></div></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Locking_the_Process"></a>Locking the Process</h4></div></div></div><p>
To ensure mutual exclusion of X Toolkit process global data, a
widget writer must use
<code class="function">XtProcessLock.</code>
</p><div class="funcsynopsis"><a id="XtProcessLock"></a><p><code class="funcdef">void <strong class="fsfunc">XtProcessLock</strong>(</code><var class="pdparam"></var><code>)</code>;</p></div><p>
<a class="xref" href="#XtProcessLock"><code class="function">XtProcessLock</code></a> blocks until it is able to acquire the lock.
Widget writers may use XtProcessLock to guarantee mutually exclusive
access to widget static data.
</p><p>
To unlock a locked process, use
<a class="xref" href="#XtProcessUnlock"><code class="function">XtProcessUnlock</code></a>.
</p><div class="funcsynopsis"><a id="XtProcessUnlock"></a><p><code class="funcdef">void <strong class="fsfunc">XtProcessUnlock</strong>(</code><var class="pdparam"></var><code>)</code>;</p></div><p>
To lock both an application context and the process at the same
time, call
<a class="xref" href="#XtAppLock"><code class="function">XtAppLock</code></a>
first and then
<a class="xref" href="#XtProcessLock"><code class="function">XtProcessLock</code></a>.
To release both locks, call
<a class="xref" href="#XtProcessUnlock"><code class="function">XtProcessUnlock</code></a>
first and then
<a class="xref" href="#XtAppUnlock"><code class="function">XtAppUnlock</code></a>.
The order is important to avoid deadlock.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Event_Management_in_a_Multi_Threaded_Environment"></a>Event Management in a Multi-Threaded Environment</h3></div></div></div><p>
In a nonthreaded environment an application writer could reasonably
assume that it is safe to exit the application from a quit callback.
This assumption may no longer hold true in a multi-threaded environment;
therefore it is desirable to provide a mechanism to terminate an
event-processing loop without necessarily terminating its thread.
</p><p>
To indicate that the event loop should terminate after the current
event dispatch has completed, use
<a class="xref" href="#XtAppSetExitFlag"><code class="function">XtAppSetExitFlag</code></a>.
</p><div class="funcsynopsis"><a id="XtAppSetExitFlag"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppSetExitFlag</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>
tests the value of the flag and will return if the flag is <code class="function">True</code>.
</p><p>
Application writers who implement their own main loop may test the
value of the exit flag with
<a class="xref" href="#XtAppGetExitFlag"><code class="function">XtAppGetExitFlag</code></a>.
</p><div class="funcsynopsis"><a id="XtAppGetExitFlag"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtAppGetExitFlag</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppGetExitFlag"><code class="function">XtAppGetExitFlag</code></a>
will normally return <code class="function">False</code>, indicating that event processing
may continue. When
<a class="xref" href="#XtAppGetExitFlag"><code class="function">XtAppGetExitFlag</code></a>
returns <code class="function">True</code>, the loop must terminate and return to the caller,
which might then destroy the application context.
</p><p>
Application writers should be aware that, if a thread is blocked in
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>,
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>,
or
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>
and another thread in the same application context opens a new display,
adds an alternate input, or a timeout, any new source(s) will not
normally be "noticed" by the blocked thread. Any new sources are
"noticed" the next time one of these functions is called.
</p><p>
The Intrinsics manage access to events on a last-in, first-out basis. If
multiple threads in the same application context block in
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>,
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>,
or
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>,
the last thread to call one of these functions is the first
thread to return.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Callbacks"></a>Chapter 8. Callbacks</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Using_Callback_Procedure_and_Callback_List_Definitions">Using Callback Procedure and Callback List Definitions</a></span></dt><dt><span class="sect1"><a href="#Identifying_Callback_Lists">Identifying Callback Lists</a></span></dt><dt><span class="sect1"><a href="#Adding_Callback_Procedures">Adding Callback Procedures</a></span></dt><dt><span class="sect1"><a href="#Removing_Callback_Procedures">Removing Callback Procedures</a></span></dt><dt><span class="sect1"><a href="#Executing_Callback_Procedures">Executing Callback Procedures</a></span></dt><dt><span class="sect1"><a href="#Checking_the_Status_of_a_Callback_List">Checking the Status of a Callback List</a></span></dt></dl></div><p>
Applications and other widgets often need to register a procedure
with a widget that gets called under certain prespecified conditions.
For example,
when a widget is destroyed,
every procedure on the widget's <span class="emphasis"><em>destroy_callbacks</em></span>
list is called to notify clients of the widget's impending doom.
</p><p>
Every widget has an XtNdestroyCallbacks callback list resource.
Widgets can define additional callback lists as they see fit.
For example, the Pushbutton widget has a callback
list to notify clients when the button has been activated.
</p><p>
Except where otherwise noted, it is the intent that all Intrinsics
functions may be called at any time, including from within callback
procedures, action routines, and event handlers.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Using_Callback_Procedure_and_Callback_List_Definitions"></a>Using Callback Procedure and Callback List Definitions</h2></div></div></div><p>
Callback procedure pointers for use in callback lists are of type
<a class="xref" href="#XtCallbackProc"><code class="function">(*XtCallbackProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtCallbackProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtCallbackProc)</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget owning the list in which the callback is registered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data supplied by the client when the procedure
was registered.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Specifies any callback-specific data the widget wants to pass to the client.
For example, when Scrollbar executes its XtNthumbChanged callback list,
it passes the new position of the thumb.
</p></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>client_data</em></span> argument provides a way for the
client registering the callback procedure also to register client-specific data,
for example, a pointer to additional information about the widget,
a reason for invoking the callback, and so on.
The <span class="emphasis"><em>client_data</em></span> value may be NULL
if all necessary information is in the widget.
The <span class="emphasis"><em>call_data</em></span> argument is a convenience to avoid having simple
cases where the client could otherwise always call
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
or a widget-specific function to retrieve data from the widget.
Widgets should generally avoid putting complex state information
in <span class="emphasis"><em>call_data</em></span>.
The client can use the more general data retrieval methods, if necessary.
</p><p>
Whenever a client wants to pass a callback list as an argument in an
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>,
or
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
call, it should specify the address
of a NULL-terminated array of type
<code class="function">XtCallbackList</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
XtCallbackProc callback;<br />
XtPointer closure;<br />
} XtCallbackRec, *XtCallbackList;<br />
</p></div><p>
For example, the callback list for procedures A and B with client data
clientDataA and clientDataB, respectively, is
</p><div class="literallayout"><p><br />
static XtCallbackRec callbacks[] = {<br />
{A, (XtPointer) clientDataA},<br />
{B, (XtPointer) clientDataB},<br />
{(XtCallbackProc) NULL, (XtPointer) NULL}<br />
};<br />
</p></div><p>
Although callback lists are passed by address in arglists
and varargs lists,
the Intrinsics recognize callback lists
through the widget resource list and will copy the contents
when necessary.
Widget initialize and set_values procedures
should not allocate memory for the callback list contents.
The Intrinsics automatically do this,
potentially using a different structure for their
internal representation.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Identifying_Callback_Lists"></a>Identifying Callback Lists</h2></div></div></div><p>
Whenever a widget contains a callback list for use by clients,
it also exports in its public .h file the resource name of the callback list.
Applications and client widgets never access callback list fields directly.
Instead, they always identify the desired callback list by using the exported
resource name.
All the callback manipulation functions described in this chapter
except
<a class="xref" href="#XtCallCallbackList"><code class="function">XtCallCallbackList</code></a>
check
to see that the requested callback list is indeed implemented by the widget.
</p><p>
For the Intrinsics to find and correctly handle callback lists,
they must be declared with a resource type of
<code class="function">XtRCallback</code>.
The internal representation of a callback list is
implementation-dependent; widgets may make no assumptions about the
value stored in this resource if it is non-NULL. Except to compare
the value to NULL (which is equivalent to
<code class="function">XtCallbackStatus</code>
<code class="function">XtCallbackHasNone ),</code>
access to callback list resources must be made
through other Intrinsics procedures.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Adding_Callback_Procedures"></a>Adding Callback Procedures</h2></div></div></div><p>
To add a callback procedure to a widget's callback list, use
<a class="xref" href="#XtAddCallback"><code class="function">XtAddCallback</code></a>.
</p><div class="funcsynopsis"><a id="XtAddCallback"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddCallback</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">callback_name</var>, XtCallbackProc <var class="pdparam">callback</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback_name</em></span>
</span></p></td><td><p>
Specifies the callback list to which the procedure is to be appended.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback</em></span>
</span></p></td><td><p>
Specifies the callback procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the specified procedure
when it is invoked,
or NULL.
</p></td></tr></tbody></table></div><p>
A callback will be invoked as many times as it occurs in the callback list.
</p><p>
To add a list of callback procedures to a given widget's callback list, use
<a class="xref" href="#XtAddCallbacks"><code class="function">XtAddCallbacks</code></a>.
</p><div class="funcsynopsis"><a id="XtAddCallbacks"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddCallbacks</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">callback_name</var>, XtCallbackList <var class="pdparam">callbacks</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback_name</em></span>
</span></p></td><td><p>
Specifies the callback list to which the procedures are to be appended.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callbacks</em></span>
</span></p></td><td><p>
Specifies the null-terminated list of callback procedures and corresponding
client data.
</p></td></tr></tbody></table></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Removing_Callback_Procedures"></a>Removing Callback Procedures</h2></div></div></div><p>
To delete a callback procedure from a widget's callback list, use
<a class="xref" href="#XtRemoveCallback"><code class="function">XtRemoveCallback</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveCallback"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveCallback</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">callback_name</var>, XtCallbackProc <var class="pdparam">callback</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback_name</em></span>
</span></p></td><td><p>
Specifies the callback list from which the procedure is to be deleted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback</em></span>
</span></p></td><td><p>
Specifies the callback procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the client data to match with the registered callback entry.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRemoveCallback"><code class="function">XtRemoveCallback</code></a>
function removes a callback only if both the procedure and the client
data match.
</p><p>
To delete a list of callback procedures from a given widget's callback list, use
<a class="xref" href="#XtRemoveCallbacks"><code class="function">XtRemoveCallbacks</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveCallbacks"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveCallbacks</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">callback_name</var>, XtCallbackList <var class="pdparam">callbacks</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback_name</em></span>
</span></p></td><td><p>
Specifies the callback list from which the procedures are to be deleted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callbacks</em></span>
</span></p></td><td><p>
Specifies the null-terminated list of callback procedures and corresponding
client data.
</p></td></tr></tbody></table></div><p>
To delete all callback procedures from a given widget's callback list
and free all storage associated with the callback list, use
<a class="xref" href="#XtRemoveAllCallbacks"><code class="function">XtRemoveAllCallbacks</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveAllCallbacks"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveAllCallbacks</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">callback_name</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback_name</em></span>
</span></p></td><td><p>
Specifies the callback list to be cleared.
</p></td></tr></tbody></table></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Executing_Callback_Procedures"></a>Executing Callback Procedures</h2></div></div></div><p>
To execute the procedures in a given widget's callback list,
specifying the callback list by resource name, use
<a class="xref" href="#XtCallCallbacks"><code class="function">XtCallCallbacks</code></a>.
</p><div class="funcsynopsis"><a id="XtCallCallbacks"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallCallbacks</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">callback_name</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback_name</em></span>
</span></p></td><td><p>
Specifies the callback list to be executed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Specifies a callback-list-specific data value to pass to each of the callback
procedure in the list, or NULL.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtCallCallbacks"><code class="function">XtCallCallbacks</code></a>
calls each of the callback procedures in the list
named by <span class="emphasis"><em>callback_name</em></span> in the specified widget, passing the client
data registered with the procedure and <span class="emphasis"><em>call-data</em></span>.
</p><p>
To execute the procedures in a callback list, specifying the callback
list by address, use
<a class="xref" href="#XtCallCallbackList"><code class="function">XtCallCallbackList</code></a>.
</p><div class="funcsynopsis"><a id="XtCallCallbackList"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallCallbackList</strong>(</code>Widget <var class="pdparam">widget</var>, XtCallbackList <var class="pdparam">callbacks</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget instance that contains the callback list. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callbacks</em></span>
</span></p></td><td><p>
Specifies the callback list to be executed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Specifies a callback-list-specific data value to pass
to each of the callback procedures in the list, or NULL.
</p></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>callbacks</em></span> parameter must specify the contents of a widget or
object resource declared with representation type
<code class="function">XtRCallback</code>.
If <span class="emphasis"><em>callbacks</em></span> is NULL,
<a class="xref" href="#XtCallCallbackList"><code class="function">XtCallCallbackList</code></a>
returns immediately; otherwise it calls each of the callback
procedures in the list, passing the client data and <span class="emphasis"><em>call_data</em></span>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Checking_the_Status_of_a_Callback_List"></a>Checking the Status of a Callback List</h2></div></div></div><p>
To find out the status of a given widget's callback list, use
<a class="xref" href="#XtHasCallbacks"><code class="function">XtHasCallbacks</code></a>.
</p><p>
typedef enum {XtCallbackNoList, XtCallbackHasNone, XtCallbackHasSome} XtCallbackStatus;
</p><div class="funcsynopsis"><a id="XtHasCallbacks"></a><p><code class="funcdef">XtCallbackStatus <strong class="fsfunc">XtHasCallbacks</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">callback_name</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback_name</em></span>
</span></p></td><td><p>
Specifies the callback list to be checked.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtHasCallbacks"><code class="function">XtHasCallbacks</code></a>
function first checks to see if the widget has a callback list identified
by <span class="emphasis"><em>callback_name</em></span>.
If the callback list does not exist,
<a class="xref" href="#XtHasCallbacks"><code class="function">XtHasCallbacks</code></a>
returns
<code class="function">XtCallbackNoList</code>.
If the callback list exists but is empty,
it returns
<code class="function">XtCallbackHasNone</code>.
If the callback list exists and has at least one callback registered,
it returns
<code class="function">XtCallbackHasSome</code>.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Resource_Management"></a>Chapter 9. Resource Management</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Resource_Lists">Resource Lists</a></span></dt><dt><span class="sect1"><a href="#Byte_Offset_Calculations">Byte Offset Calculations</a></span></dt><dt><span class="sect1"><a href="#Superclass_to_Subclass_Chaining_of_Resource_Lists">Superclass-to-Subclass Chaining of Resource Lists</a></span></dt><dt><span class="sect1"><a href="#Subresources">Subresources</a></span></dt><dt><span class="sect1"><a href="#Obtaining_Application_Resources">Obtaining Application Resources</a></span></dt><dt><span class="sect1"><a href="#Resource_Conversions">Resource Conversions</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Predefined_Resource_Converters">Predefined Resource Converters</a></span></dt><dt><span class="sect2"><a href="#New_Resource_Converters">New Resource Converters</a></span></dt><dt><span class="sect2"><a href="#Issuing_Conversion_Warnings">Issuing Conversion Warnings</a></span></dt><dt><span class="sect2"><a href="#Registering_a_New_Resource_Converter">Registering a New Resource Converter</a></span></dt><dt><span class="sect2"><a href="#Resource_Converter_Invocation">Resource Converter Invocation</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Reading_and_Writing_Widget_State">Reading and Writing Widget State</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Obtaining_Widget_State">Obtaining Widget State</a></span></dt><dt><span class="sect2"><a href="#Setting_Widget_State">Setting Widget State</a></span></dt></dl></dd></dl></div><p>
A resource is a field in the widget record with a corresponding
resource entry in the <span class="emphasis"><em>resources</em></span> list of the widget or any of its
superclasses.
This means that the field is
settable by
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
(by naming the field in the argument list), by an
entry in a resource file (by using either the name or class), and by
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>.
In addition, it is readable by
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>.
Not all fields in a widget record are resources.
Some are for bookkeeping use by the
generic routines (like <span class="emphasis"><em>managed</em></span> and <span class="emphasis"><em>being_destroyed</em></span>).
Others can be for local bookkeeping,
and still others are derived from resources
(many graphics contexts and pixmaps).
</p><p>
Widgets typically need to obtain a large set of resources at widget
creation time.
Some of the resources come from the argument list supplied in the call to
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>,
some from the resource database,
and some from the internal defaults specified by the widget.
Resources are obtained first from the argument list,
then from the resource database for all resources not specified
in the argument list,
and last, from the internal default, if needed.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Resource_Lists"></a>Resource Lists</h2></div></div></div><p>
A resource entry specifies a field in the widget,
the textual name and class of the field that argument lists
and external resource files use to refer to the field,
and a default value that the field should get if no value is specified.
The declaration for the
<code class="function">XtResource</code>
structure is
</p><div class="literallayout"><p><br />
typedef struct {<br />
String resource_name;<br />
String resource_class;<br />
String resource_type;<br />
Cardinal resource_size;<br />
Cardinal resource_offset;<br />
String default_type;<br />
XtPointer default_addr;<br />
} XtResource, *XtResourceList;<br />
</p></div><p>
When the resource list is specified as the
<code class="function">CoreClassPart</code>,
<code class="function">ObjectClassPart</code>,
<code class="function">RectObjClassPart</code>,
or
<code class="function">ConstraintClassPart</code>
<span class="emphasis"><em>resources</em></span> field, the strings pointed to by <span class="emphasis"><em>resource_name</em></span>,
<span class="emphasis"><em>resource_class</em></span>, <span class="emphasis"><em>resource_type</em></span>, and <span class="emphasis"><em>default_type</em></span> must
be permanently allocated prior to or during the execution of the class
initialization procedure and must not be subsequently deallocated.
</p><p>
The <span class="emphasis"><em>resource_name</em></span> field contains the name used by clients to access the field
in the widget.
By convention, it starts with a lowercase letter
and is spelled exactly like the field name,
except all underscores (_) are deleted and the next letter is replaced by its
uppercase counterpart.
For example, the resource name for background_pixel becomes backgroundPixel.
Resource names beginning with the two-character
sequence ``xt'', and resource classes beginning with the two-character
sequence ``Xt'' are reserved to the Intrinsics for future standard and
implementation-dependent uses.
Widget header files typically contain a symbolic name for each resource name.
All resource names, classes, and types used by the Intrinsics are named in
<code class="function"><X11/StringDefs.h></code>.
The Intrinsics's symbolic resource names begin with
``XtN''
and are followed by the string name (for example, XtNbackgroundPixel
for backgroundPixel).
</p><p>
The <span class="emphasis"><em>resource_class</em></span> field contains the class string used in resource
specification files to identify the field.
A resource class provides two functions:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
It isolates an application from different representations that widgets
can use for a similar resource.
</p></li><li class="listitem"><p>
It lets you specify values for several actual resources with a single name.
A resource class should be chosen to span a group of closely related fields.
</p></li></ul></div><p>
For example,
a widget can have several pixel resources: background, foreground,
border, block cursor, pointer cursor, and so on.
Typically, the background defaults to white
and everything else to black.
The resource class for each of these resources in the resource list
should be chosen so that it takes the minimal number of entries
in the resource database to make the background ivory
and everything else darkblue.
</p><p>
In this case, the background pixel should have a resource class of
``Background''
and all the other pixel entries a resource class of
``Foreground''.
Then, the resource file needs only two lines to
change all pixels to ivory or darkblue:
</p><div class="literallayout"><p><br />
*Background: ivory<br />
*Foreground: darkblue<br />
</p></div><p>
Similarly, a widget may have several font resources (such as normal and bold),
but all fonts should have the class Font.
Thus, changing all fonts simply requires only a single line in the
default resource file:
</p><div class="literallayout"><p><br />
*Font: 6x13<br />
</p></div><p>
By convention,
resource classes are always spelled starting with a capital letter
to distinguish them from resource names.
Their symbolic names are preceded with
``XtC''
(for example, XtCBackground).
</p><p>
The <span class="emphasis"><em>resource_type</em></span> field gives the physical representation type of the resource
and also encodes information about the specific usage of the field.
By convention, it starts with an uppercase letter and is
spelled identically to the type name of the field.
The resource type is used when resources are fetched to
convert from the resource database format (usually
<code class="function">String</code>)
or the format of the resource default value
(almost anything, but often
<code class="function">String</code>)
to the desired
physical representation (see <a class="xref" href="#Resource_Conversions" title="Resource Conversions">the section called “Resource Conversions”</a>).
The Intrinsics define the following resource types:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Resource Type</th><th align="left">Structure or Field Type</th></tr></thead><tbody><tr><td align="left"><code class="function">XtRAcceleratorTable</code></td><td align="left">XtAccelerators</td></tr><tr><td align="left"><code class="function">XtRAtom</code></td><td align="left">Atom</td></tr><tr><td align="left"><code class="function">XtRBitmap</code></td><td align="left">Pixmap, depth=1</td></tr><tr><td align="left"><code class="function">XtRBoolean</code></td><td align="left">Boolean</td></tr><tr><td align="left"><code class="function">XtRBool</code></td><td align="left">Bool</td></tr><tr><td align="left"><code class="function">XtRCallback</code></td><td align="left">XtCallbackList</td></tr><tr><td align="left"><code class="function">XtRCardinal</code></td><td align="left">Cardinal</td></tr><tr><td align="left"><code class="function">XtRColor</code></td><td align="left">XColor</td></tr><tr><td align="left"><code class="function">XtRColormap</code></td><td align="left">Colormap</td></tr><tr><td align="left"><code class="function">XtRCommandArgArray</code></td><td align="left">String*</td></tr><tr><td align="left"><code class="function">XtRCursor</code></td><td align="left">Cursor</td></tr><tr><td align="left"><code class="function">XtRDimension</code></td><td align="left">Dimension</td></tr><tr><td align="left"><code class="function">XtRDirectoryString</code></td><td align="left">String</td></tr><tr><td align="left"><code class="function">XtRDisplay</code></td><td align="left">Display*</td></tr><tr><td align="left"><code class="function">XtREnum</code></td><td align="left">XtEnum</td></tr><tr><td align="left"><code class="function">XtREnvironmentArray</code></td><td align="left">String*</td></tr><tr><td align="left"><code class="function">XtRFile</code></td><td align="left">FILE*</td></tr><tr><td align="left"><code class="function">XtRFloat</code></td><td align="left">float</td></tr><tr><td align="left"><code class="function">XtRFont</code></td><td align="left">Font</td></tr><tr><td align="left"><code class="function">XtRFontSet</code></td><td align="left">XFontSet</td></tr><tr><td align="left"><code class="function">XtRFontStruct</code></td><td align="left">XFontStruct*</td></tr><tr><td align="left"><code class="function">XtRFunction</code></td><td align="left">(*)()</td></tr><tr><td align="left"><code class="function">XtRGeometry</code></td><td align="left">char*, format as defined by
<code class="function">XParseGeometry</code></td></tr><tr><td align="left"><code class="function">XtRGravity</code></td><td align="left">int</td></tr><tr><td align="left"><code class="function">XtRInitialState</code></td><td align="left">int</td></tr><tr><td align="left"><code class="function">XtRInt</code></td><td align="left">int</td></tr><tr><td align="left"><code class="function">XtRLongBoolean</code></td><td align="left">long</td></tr><tr><td align="left"><code class="function">XtRObject</code></td><td align="left">Object</td></tr><tr><td align="left"><code class="function">XtRPixel</code></td><td align="left">Pixel</td></tr><tr><td align="left"><code class="function">XtRPixmap</code></td><td align="left">Pixmap</td></tr><tr><td align="left"><code class="function">XtRPointer</code></td><td align="left">XtPointer</td></tr><tr><td align="left"><code class="function">XtRPosition</code></td><td align="left">Position</td></tr><tr><td align="left"><code class="function">XtRRestartStyle</code></td><td align="left">unsigned char</td></tr><tr><td align="left"><code class="function">XtRScreen</code></td><td align="left">Screen*</td></tr><tr><td align="left"><code class="function">XtRShort</code></td><td align="left">short</td></tr><tr><td align="left"><code class="function">XtRSmcConn</code></td><td align="left">XtPointer</td></tr><tr><td align="left"><code class="function">XtRString</code></td><td align="left">String</td></tr><tr><td align="left"><code class="function">XtRStringArray</code></td><td align="left">String*</td></tr><tr><td align="left"><code class="function">XtRStringTable</code></td><td align="left">String*</td></tr><tr><td align="left"><code class="function">XtRTranslationTable</code></td><td align="left">XtTranslations</td></tr><tr><td align="left"><code class="function">XtRUnsignedChar</code></td><td align="left">unsigned char</td></tr><tr><td align="left"><code class="function">XtRVisual</code></td><td align="left">Visual*</td></tr><tr><td align="left"><code class="function">XtRWidget</code></td><td align="left">Widget</td></tr><tr><td align="left"><code class="function">XtRWidgetClass</code></td><td align="left">WidgetClass</td></tr><tr><td align="left"><code class="function">XtRWidgetList</code></td><td align="left">WidgetList</td></tr><tr><td align="left"><code class="function">XtRWindow</code></td><td align="left">Window</td></tr></tbody></table></div><p>
<code class="function"><X11/StringDefs.h></code>
also defines the following resource types as a
convenience for widgets, although they do not have any corresponding
data type assigned:
<code class="function">XtREditMode</code>,
<code class="function">XtRJustify</code>,
and
<code class="function">XtROrientation</code>.
</p><p>
The <span class="emphasis"><em>resource_size</em></span> field is the size of the physical representation in bytes;
you should specify it as
<code class="function">sizeof</code>(type) so that the
compiler fills in the value.
The <span class="emphasis"><em>resource_offset</em></span> field is the offset in bytes of the field
within the widget.
You should use the
<a class="xref" href="#XtOffsetOf"><code class="function">XtOffsetOf</code></a>
macro to retrieve this value.
The <span class="emphasis"><em>default_type</em></span> field is the representation type of the default
resource value.
If <span class="emphasis"><em>default_type</em></span> is different from <span class="emphasis"><em>resource_type</em></span> and the default value
is needed,
the resource manager invokes a conversion procedure from <span class="emphasis"><em>default_type</em></span>
to <span class="emphasis"><em>resource_type</em></span>.
Whenever possible,
the default type should be identical to the resource type in order
to minimize widget creation time.
However, there are sometimes no values of the type that the program
can easily specify.
In this case,
it should be a value for which the converter is guaranteed to work (for example,
<code class="function">XtDefaultForeground</code>
for a pixel resource).
The <span class="emphasis"><em>default_addr</em></span> field specifies the address of the default resource value.
As a special case, if <span class="emphasis"><em>default_type</em></span> is
<code class="function">XtRString</code>,
then the value in the <span class="emphasis"><em>default_addr</em></span> field is the pointer to
the string rather than a pointer to the pointer.
The default is used if a resource is not specified in the argument list
or in the resource database or if the conversion from the representation
type stored in the resource database fails,
which can happen for various reasons (for example, a misspelled entry in a
resource file).
</p><p>
Two special representation types
(XtRImmediate
and
XtRCallProc)
are usable only as default resource types.
XtRImmediate
indicates that the value in the <span class="emphasis"><em>default_addr</em></span> field is the actual value of
the resource rather than the address of the value.
The value must be in the correct representation type for the resource,
coerced to an
<code class="function">XtPointer</code>.
No conversion is possible, since there is no source representation type.
XtRCallProc
indicates that the value in the <span class="emphasis"><em>default_addr</em></span> field is a procedure
pointer.
This procedure is automatically invoked with the widget,
<span class="emphasis"><em>resource_offset</em></span>, and a pointer to an
<code class="function">XrmValue</code>
in which to store the result.
XtRCallProc
procedure pointers are of type
<a class="xref" href="#XtResourceDefaultProc"><code class="function">(*XtResourceDefaultProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtResourceDefaultProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtResourceDefaultProc)</strong>(</code>Widget <var class="pdparam">w</var>, int <var class="pdparam">offset</var>, XrmValue *<var class="pdparam">value</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget whose resource value is to be obtained.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>offset</em></span>
</span></p></td><td><p>
Specifies the offset of the field in the widget record.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value</em></span>
</span></p></td><td><p>
Specifies the resource value descriptor to return.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtResourceDefaultProc"><code class="function">(*XtResourceDefaultProc)</code></a>
procedure should fill in the <span class="emphasis"><em>value->addr</em></span> field with a pointer
to the resource value in its correct representation type.
</p><p>
To get the resource list structure for a particular class, use
<a class="xref" href="#XtGetResourceList"><code class="function">XtGetResourceList</code></a>.
</p><div class="funcsynopsis"><a id="XtGetResourceList"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetResourceList</strong>(</code>WidgetClass <var class="pdparam">class</var>, XtResourceList *<var class="pdparam">resources_return</var>, Cardinal *<var class="pdparam">num_resources_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the object class to be queried. It must be
<code class="function">objectClass</code>
or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources_return</em></span>
</span></p></td><td><p>
Returns the resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources_return</em></span>
</span></p></td><td><p>
Returns the number of entries in the resource list.
</p></td></tr></tbody></table></div><p>
If
<a class="xref" href="#XtGetResourceList"><code class="function">XtGetResourceList</code></a>
is called before the class is initialized,
it returns the resource list as specified in the class record.
If it is called after the class has been initialized,
<a class="xref" href="#XtGetResourceList"><code class="function">XtGetResourceList</code></a>
returns a merged resource list that includes the resources
for all superclasses.
The list returned by
<a class="xref" href="#XtGetResourceList"><code class="function">XtGetResourceList</code></a>
should be freed using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is no longer needed.
</p><p>
To get the constraint resource list structure for a particular widget
class, use
<a class="xref" href="#XtGetConstraintResourceList"><code class="function">XtGetConstraintResourceList</code></a>.
</p><div class="funcsynopsis"><a id="XtGetConstraintResourceList"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetConstraintResourceList</strong>(</code>WidgetClass <var class="pdparam">class</var>, XtResourceList *<var class="pdparam">resources_return</var>, Cardinal *<var class="pdparam">num_resources_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the object class to be queried. It must be
<code class="function">objectClass</code>
or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources_return</em></span>
</span></p></td><td><p>
Returns the constraint resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources_return</em></span>
</span></p></td><td><p>
Returns the number of entries in the constraint resource list.
</p></td></tr></tbody></table></div><p>
If
<a class="xref" href="#XtGetConstraintResourceList"><code class="function">XtGetConstraintResourceList</code></a>
is called before the widget class is
initialized, the resource list as specified in the widget
class Constraint part is returned. If
<a class="xref" href="#XtGetConstraintResourceList"><code class="function">XtGetConstraintResourceList</code></a>
is called after the widget class has been initialized, the merged
resource list for the class and all Constraint superclasses is
returned. If the
specified class is not a subclass of
<code class="function">constraintWidgetClass</code>,
*<span class="emphasis"><em>resources_return</em></span> is set to NULL
and *<span class="emphasis"><em>num_resources_return</em></span> is set to zero.
The list returned by
<a class="xref" href="#XtGetConstraintResourceList"><code class="function">XtGetConstraintResourceList</code></a>
should be freed using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is no longer needed.
</p><p>
The routines
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
and
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
also use the resource list to set and get widget state;
see <a class="xref" href="#Obtaining_Widget_State" title="Obtaining Widget State">the section called “Obtaining Widget State”</a> and
<a class="xref" href="#Setting_Widget_State" title="Setting Widget State">the section called “Setting Widget State”</a>.
</p><p>
Here is an abbreviated version of a possible resource list for a Label widget:
</p><div class="literallayout"><p><br />
/* Resources specific to Label */<br />
static XtResource resources[] = {<br />
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),<br />
XtOffsetOf(LabelRec, label.foreground), XtRString, XtDefaultForeground},<br />
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct*),<br />
XtOffsetOf(LabelRec, label.font), XtRString, XtDefaultFont},<br />
{XtNlabel, XtCLabel, XtRString, sizeof(String),<br />
XtOffsetOf(LabelRec, label.label), XtRString, NULL},<br />
.<br />
.<br />
.<br />
}<br />
</p></div><p>
The complete resource name for a field of a widget instance is the
concatenation of the application shell name (from
<code class="function">XtAppCreateShell ),</code>
the instance names of all the widget's parents up to the
top of the widget tree,
the instance name of the widget itself,
and the resource name of the specified field of the widget.
Similarly,
the full resource class of a field of a widget instance is the
concatenation of the application class (from
<code class="function">XtAppCreateShell ),</code>
the widget class names of all the widget's parents up to the
top of the widget tree,
the widget class name of the widget itself,
and the resource class of the specified field of the widget.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Byte_Offset_Calculations"></a>Byte Offset Calculations</h2></div></div></div><p>
To determine the byte offset of a field within a structure type, use
<a class="xref" href="#XtOffsetOf"><code class="function">XtOffsetOf</code></a>.
</p><div class="funcsynopsis"><a id="XtOffsetOf"></a><p><code class="funcdef">Cardinal <strong class="fsfunc">XtOffsetOf</strong>(</code>Type <var class="pdparam">structure_type</var>, Field <var class="pdparam">field_name</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>structure_type</em></span>
</span></p></td><td><p>
Specifies a type that is declared as a structure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>field_name</em></span>
</span></p></td><td><p>
Specifies the name of a member within the structure.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtOffsetOf"><code class="function">XtOffsetOf</code></a>
macro expands to a constant expression that gives the
offset in bytes to the specified structure member from the beginning
of the structure. It is normally used to statically initialize
resource lists and is more portable than
<a class="xref" href="#XtOffset"><code class="function">XtOffset</code></a>,
which serves the same function.
</p><p>
To determine the byte offset of a field within a structure pointer type, use
<a class="xref" href="#XtOffset"><code class="function">XtOffset</code></a>.
</p><div class="funcsynopsis"><a id="XtOffset"></a><p><code class="funcdef">Cardinal <strong class="fsfunc">XtOffset</strong>(</code>Type <var class="pdparam"> pointer_type</var>, Field <var class="pdparam"> field_name</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>pointer_type</em></span>
</span></p></td><td><p>
Specifies a type that is declared as a pointer to a structure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>field_name</em></span>
</span></p></td><td><p>
Specifies the name of a member within the structure.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtOffset"><code class="function">XtOffset</code></a>
macro expands to a constant expression that gives the
offset in bytes to the specified structure member from the beginning
of the structure. It may be used to statically initialize
resource lists.
<a class="xref" href="#XtOffset"><code class="function">XtOffset</code></a>
is less portable than
<a class="xref" href="#XtOffsetOf"><code class="function">XtOffsetOf</code></a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Superclass_to_Subclass_Chaining_of_Resource_Lists"></a>Superclass-to-Subclass Chaining of Resource Lists</h2></div></div></div><p>
The
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
function gets resources as a superclass-to-subclass chained operation.
That is, the resources specified in the
<code class="function">objectClass</code>
resource list are fetched,
then those in
<code class="function">rectObjClass</code>,
and so on down to the resources specified
for this widget's class. Within a class, resources are fetched in the order
they are declared.
</p><p>
In general, if a widget resource field is declared in a superclass,
that field is included in the superclass's resource list and need not be
included in the subclass's resource list.
For example, the
Core
class contains a resource entry for <span class="emphasis"><em>background_pixel</em></span>.
Consequently,
the implementation of Label need not also have a resource entry
for <span class="emphasis"><em>background_pixel</em></span>.
However, a subclass,
by specifying a resource entry for that field in its own resource list,
can override the resource entry for any field declared in a superclass.
This is most often done to override the defaults provided in the
superclass with new ones.
At class initialization time,
resource lists for that class are scanned from the superclass down
to the class to look for resources with the same offset.
A matching resource in a subclass will be reordered to override
the superclass entry.
If reordering is necessary, a copy of the superclass resource list is made to
avoid affecting other subclasses of the superclass.
</p><p>
Also at class initialization time, the Intrinsics produce an
internal representation of the resource list to optimize access time
when creating widgets. In order to save memory, the Intrinsics may
overwrite the storage allocated for the resource list in the class
record; therefore, widgets must allocate resource lists in writable
storage and must not access the list contents directly after the
class_initialize procedure has returned.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Subresources"></a>Subresources</h2></div></div></div><p>
A widget does not do anything to retrieve its own resources;
instead,
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
does this automatically before calling the class initialize procedure.
</p><p>
Some widgets have subparts that are not widgets but for which the widget
would like to fetch resources.
Such widgets call
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>
to accomplish this.
</p><div class="funcsynopsis"><a id="XtGetSubresources"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetSubresources</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">base</var>, String <var class="pdparam">name</var>, String <var class="pdparam">class</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the object used to qualify the subpart resource name and
class. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address of the subpart data structure into which the
resources will be written.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the name of the subpart.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the class of the subpart.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the resource list for the subpart.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any other resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>
function constructs a name and class list from the application name and class,
the names and classes of all the object's ancestors, and the object itself.
Then it appends to this list the <span class="emphasis"><em>name</em></span> and <span class="emphasis"><em>class</em></span> pair passed in.
The resources are fetched from the argument list, the resource database,
or the default values in the resource list.
Then they are copied into the subpart record.
If <span class="emphasis"><em>args</em></span> is NULL,
<span class="emphasis"><em>num_args</em></span> must be zero.
However, if <span class="emphasis"><em>num_args</em></span> is zero,
the argument list is not referenced.
</p><p>
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>
may overwrite the specified resource list with an
equivalent representation in an internal format, which optimizes access
time if the list is used repeatedly. The resource list must be
allocated in writable storage, and the caller must not modify the list
contents after the call if the same list is to be used again.
Resources fetched by
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>
are reference-counted as
if they were referenced by the specified object. Subresources might
therefore be freed from the conversion cache and destroyed
when the object is destroyed, but not before then.
</p><p>
To fetch resources for widget subparts using varargs lists, use
<a class="xref" href="#XtVaGetSubresources"><code class="function">XtVaGetSubresources</code></a>.
</p><div class="funcsynopsis"><a id="XtVaGetSubresources"></a><p><code class="funcdef">void <strong class="fsfunc">XtVaGetSubresources</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">base</var>, String <var class="pdparam">name</var>, String <var class="pdparam">class</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the object used to qualify the subpart resource name and
class. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address of the subpart data structure into which the
resources will be written.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the name of the subpart.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the class of the subpart.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the resource list for the subpart.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaGetSubresources"><code class="function">XtVaGetSubresources</code></a>
is identical in function to
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list, as
described in Section 2.5.1.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Obtaining_Application_Resources"></a>Obtaining Application Resources</h2></div></div></div><p>
To retrieve resources that are not specific to a widget
but apply to the overall application, use
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>.
</p><div class="funcsynopsis"><a id="XtGetApplicationResources"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetApplicationResources</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">base</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the object that identifies the resource database to search
(the database is that associated with the display for this object). Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address into which
the resource values will be written.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any other resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>
function first uses the passed object,
which is usually an application shell widget,
to construct a resource name and class list.
The full name and class of the specified object (that is, including its
ancestors, if any) is logically added to the
front of each resource name and class.
Then it retrieves the resources from the argument list,
the resource database, or the resource list default values.
After adding base to each address,
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>
copies the resources into the addresses
obtained by adding <span class="emphasis"><em>base</em></span> to each <span class="emphasis"><em>offset</em></span> in the resource list.
If <span class="emphasis"><em>args</em></span> is NULL,
<span class="emphasis"><em>num_args</em></span> must be zero.
However, if <span class="emphasis"><em>num_args</em></span> is zero,
the argument list is not referenced.
The portable way to specify application resources is to declare them
as members of a structure and pass the address of the structure
as the <span class="emphasis"><em>base</em></span> argument.
</p><p>
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>
may overwrite the specified resource list
with an equivalent representation in an internal format, which
optimizes access time if the list is used repeatedly. The resource
list must be allocated in writable storage, and the caller must not
modify the list contents after the call if the same list is to be
used again. Any per-display resources fetched by
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>
will not be freed from the resource cache until the display is closed.
</p><p>
To retrieve resources for the overall application using varargs lists, use
<a class="xref" href="#XtVaGetApplicationResources"><code class="function">XtVaGetApplicationResources</code></a>.
</p><div class="funcsynopsis"><a id="XtVaGetApplicationResources"></a><p><code class="funcdef">void <strong class="fsfunc">XtVaGetApplicationResources</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">base</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the object that identifies the resource database to search
(the database is that associated with the display for this object). Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address into which
the resource values will be written.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the resource list for the subpart.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaGetApplicationResources"><code class="function">XtVaGetApplicationResources</code></a>
is identical in function to
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters
replaced by a varargs list, as described in Section 2.5.1.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Resource_Conversions"></a>Resource Conversions</h2></div></div></div><p>
The Intrinsics provide a mechanism for registering representation converters that
are automatically invoked by the resource-fetching routines.
The Intrinsics additionally provide and register several commonly used converters.
This resource conversion mechanism serves several purposes:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
It permits user and application resource files to contain textual
representations of nontextual values.
</p></li><li class="listitem"><p>
It allows textual or other representations of default resource values that
are dependent on the display, screen, or colormap, and thus must be
computed at runtime.
</p></li><li class="listitem"><p>
It caches conversion source and result data.
Conversions that require much computation or space
(for example, string-to-translation-table)
or that require round-trips to the server
(for example, string-to-font or string-to-color) are performed only once.
</p></li></ul></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Predefined_Resource_Converters"></a>Predefined Resource Converters</h3></div></div></div><p>
The Intrinsics define all the representations used in the
Object,
RectObj,
Core,
Composite,
Constraint,
and
Shell
widget classes.
The Intrinsics register the following resource converters that accept
input values of representation type
<code class="function">XtRString</code>.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Target Representation</th><th align="left">Converter Name</th><th align="left">Additional Args</th></tr></thead><tbody><tr><td align="left"><code class="function">XtRAcceleratorTable</code></td><td align="left"><code class="function">XtCvtStringToAcceleratorTable</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRAtom</code></td><td align="left"><code class="function">XtCvtStringToAtom</code></td><td align="left">Display*</td></tr><tr><td align="left"><code class="function">XtRBoolean</code></td><td align="left"><code class="function">XtCvtStringToBoolean</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRBool</code></td><td align="left"><code class="function">XtCvtStringToBool</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRCommandArgArray</code></td><td align="left"><code class="function">XtCvtStringToCommandArgArray</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRCursor</code></td><td align="left"><code class="function">XtCvtStringToCursor</code></td><td align="left">Display*</td></tr><tr><td align="left"><code class="function">XtRDimension</code></td><td align="left"><code class="function">XtCvtStringToDimension</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRDirectoryString</code></td><td align="left"><code class="function">XtCvtStringToDirectoryString</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRDisplay</code></td><td align="left"><code class="function">XtCvtStringToDisplay</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRFile</code></td><td align="left"><code class="function">XtCvtStringToFile</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRFloat</code></td><td align="left"><code class="function">XtCvtStringToFloat</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRFont</code></td><td align="left"><code class="function">XtCvtStringToFont</code></td><td align="left">Display*</td></tr><tr><td align="left"><code class="function">XtRFontSet</code></td><td align="left"><code class="function">XtCvtStringToFontSet</code></td><td align="left">Display*, String <span class="emphasis"><em>locale</em></span></td></tr><tr><td align="left"><code class="function">XtRFontStruct</code></td><td align="left"><code class="function">XtCvtStringToFontStruct</code></td><td align="left">Display*</td></tr><tr><td align="left"><code class="function">XtRGravity</code></td><td align="left"><code class="function">XtCvtStringToGravity</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRInitialState</code></td><td align="left"><code class="function">XtCvtStringToInitialState</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRInt</code></td><td align="left"><code class="function">XtCvtStringToInt</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRPixel</code></td><td align="left"><code class="function">XtCvtStringToPixel</code></td><td align="left"><code class="function">colorConvertArgs</code></td></tr><tr><td align="left"><code class="function">XtRPosition</code></td><td align="left"><code class="function">XtCvtStringToPosition</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRRestartStyle</code></td><td align="left"><code class="function">XtCvtStringToRestartStyle</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRShort</code></td><td align="left"><code class="function">XtCvtStringToShort</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRTranslationTable</code></td><td align="left"><code class="function">XtCvtStringToTranslationTable</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRUnsignedChar</code></td><td align="left"><code class="function">XtCvtStringToUnsignedChar</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRVisual</code></td><td align="left"><code class="function">XtCvtStringToVisual</code></td><td align="left">Screen*, Cardinal <span class="emphasis"><em>depth</em></span></td></tr></tbody></table></div><p>
The String-to-Pixel conversion has two predefined constants that are
guaranteed to work and contrast with each other:
<code class="function">XtDefaultForeground</code>
and
<code class="function">XtDefaultBackground</code>.
They evaluate to the black and white pixel values of the widget's screen,
respectively.
If the application resource reverseVideo is
<code class="function">True</code>,
they evaluate to the white and black pixel values of the widget's screen,
respectively.
Similarly, the String-to-Font and String-to-FontStruct converters recognize
the constant
<code class="function">XtDefaultFont</code>
and evaluate this in the following manner:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Query the resource database for the resource whose full name
is ``xtDefaultFont'', class ``XtDefaultFont'' (that is, no widget
name/class prefixes), and use a type
<code class="function">XtRString</code>
value returned as the font name or a type
<code class="function">XtRFont</code>
or
<code class="function">XtRFontStruct</code>
value directly as the resource value.
</p></li><li class="listitem"><p>
If the resource database does not contain a value for xtDefaultFont,
class XtDefaultFont, or if the returned font name cannot be
successfully opened, an implementation-defined font in ISO8859-1
character set encoding is opened. (One possible algorithm is to
perform an
<code class="function">XListFonts</code>
using a wildcard font name and use the first
font in the list. This wildcard font name should be as broad as
possible to maximize the probability of locating a useable font;
for example, "-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1".)
</p></li><li class="listitem"><p>
If no suitable ISO8859-1 font can be found, issue a warning message
and return
<code class="function">False</code>.
</p></li></ul></div><p>
The String-to-FontSet converter recognizes the constant
<code class="function">XtDefaultFontSet</code>
and evaluate this in the following manner:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Query the resource database for the resource whose full name
is ``xtDefaultFontSet'', class ``XtDefaultFontSet'' (that is, no widget
name/class prefixes), and use a type
<code class="function">XtRString</code>
value returned as the base font name list or a type
<code class="function">XtRFontSet</code>
value directly as the resource value.
</p></li><li class="listitem"><p>
If the resource database does not contain a value for xtDefaultFontSet,
class XtDefaultFontSet, or if a font set cannot be
successfully created from this resource,
an implementation-defined font set is created.
(One possible algorithm is to
perform an
<code class="function">XCreateFontSet</code>
using a wildcard base font name.
This wildcard base font name should be as broad as
possible to maximize the probability of locating a useable font;
for example, "-*-*-*-R-*-*-*-120-*-*-*-*".)
</p></li><li class="listitem"><p>
If no suitable font set can be created, issue a warning message
and return
<code class="function">False</code>.
</p></li></ul></div><p>
If a font set is created but <span class="emphasis"><em>missing_charset_list</em></span> is not
empty, a warning is issued and the partial font set is returned.
The Intrinsics register the String-to-FontSet converter with
a conversion argument list that extracts the current process
locale at the time the converter is invoked. This ensures
that the converter is invoked again if the same conversion
is required in a different locale.
</p><p>
The String-to-Gravity conversion accepts string values that are the
names of window and bit gravities and their numerical equivalents,
as defined in <span class="emphasis"><em>Xlib — C Language X Interface.</em></span>:
<code class="function">ForgetGravity</code>,
<code class="function">UnmapGravity</code>,
<code class="function">NorthWestGravity</code>,
<code class="function">NorthGravity</code>,
<code class="function">NorthEastGravity</code>,
<code class="function">WestGravity</code>,
<code class="function">CenterGravity</code>,
<code class="function">EastGravity</code>,
<code class="function">SouthWestGravity</code>,
<code class="function">SouthGravity</code>,
<code class="function">SouthEastGravity</code>,
and
<code class="function">StaticGravity</code>.
Alphabetic case is not significant in the conversion.
</p><p>
The String-to-CommandArgArray conversion parses a String into an
array of strings.
White space characters separate elements of the command line.
The converter recognizes the backslash character ``\\'' as an escape
character to allow the following white space character to be part of the
array element.
</p><p>
The String-to-DirectoryString conversion recognizes the
string ``XtCurrentDirectory'' and returns the result of a call
to the operating system to get the current directory.
</p><p>
The String-to-RestartStyle conversion accepts the values
<code class="function">RestartIfRunning</code>,
<code class="function">RestartAnyway</code>,
<code class="function">RestartImmediately</code>,
and
<code class="function">RestartNever</code>
as defined by the <span class="emphasis"><em>X Session Management Protocol</em></span>.
</p><p>
The String-to-InitialState conversion accepts the values
<code class="function">NormalState</code>
or
<code class="function">IconicState</code>
as defined by the <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span>.
</p><p>
The String-to-Visual conversion calls
<code class="function">XMatchVisualInfo</code>
using the
<span class="emphasis"><em>screen</em></span> and <span class="emphasis"><em>depth</em></span> fields from the core part and returns the first
matching Visual on the list. The widget resource list must be certain
to specify any resource of type
<code class="function">XtRVisual</code>
after the depth resource.
The allowed string values are the visual class names defined in <span class="emphasis"><em>X Window System Protocol</em></span>,
Section 8;
<code class="function">StaticGray</code>,
<code class="function">StaticColor</code>,
<code class="function">TrueColor</code>,
<code class="function">GrayScale</code>,
<code class="function">PseudoColor</code>,
and
<code class="function">DirectColor</code>.
</p><p>
The Intrinsics register the following resource converter that accepts
an input value of representation type
<code class="function">XtRColor</code>.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Target Representation</th><th align="left">Converter Name</th><th align="left">Additional Args</th></tr></thead><tbody><tr><td align="left"><code class="function">XtRPixel</code></td><td align="left"><code class="function">XtCvtColorToPixel</code></td><td class="auto-generated"> </td></tr></tbody></table></div><p>
The Intrinsics register the following resource converters that accept
input values of representation type
<code class="function">XtRInt</code>.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Target Representation</th><th align="left">Converter Name</th><th align="left">Additional Args</th></tr></thead><tbody><tr><td align="left"><code class="function">XtRBoolean</code></td><td align="left"><code class="function">XtCvtIntToBoolean</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRBool</code></td><td align="left"><code class="function">XtCvtIntToBool</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRColor</code></td><td align="left"><code class="function">XtCvtIntToColor</code></td><td align="left"><code class="function">colorConvertArgs</code></td></tr><tr><td align="left"><code class="function">XtRDimension</code></td><td align="left"><code class="function">XtCvtIntToDimension</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRFloat</code></td><td align="left"><code class="function">XtCvtIntToFloat</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRFont</code></td><td align="left"><code class="function">XtCvtIntToFont</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRPixel</code></td><td align="left"><code class="function">XtCvtIntToPixel</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRPixmap</code></td><td align="left"><code class="function">XtCvtIntToPixmap</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRPosition</code></td><td align="left"><code class="function">XtCvtIntToPosition</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRShort</code></td><td align="left"><code class="function">XtCvtIntToShort</code></td><td class="auto-generated"> </td></tr><tr><td align="left"><code class="function">XtRUnsignedChar</code></td><td align="left"><code class="function">XtCvtIntToUnsignedChar</code></td><td class="auto-generated"> </td></tr></tbody></table></div><p>
The Intrinsics register the following resource converter that accepts
an input value of representation type
<code class="function">XtRPixel</code>.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Target Representation</th><th align="left">Converter Name</th><th align="left">Additional Args</th></tr></thead><tbody><tr><td align="left"><code class="function">XtRColor</code></td><td align="left"><code class="function">XtCvtPixelToColor</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="New_Resource_Converters"></a>New Resource Converters</h3></div></div></div><p>
Type converters use pointers to
<code class="function">XrmValue</code>
structures (defined in
<code class="function"><X11/Xresource.h>;</code>
see <span class="olink">Section 15.4</span> in
<span class="olink">Xlib — C Language X Interface.</span>)
for input and output values.
</p><div class="literallayout"><p><br />
typedef struct {<br />
unsigned int size;<br />
XPointer addr;<br />
} XrmValue, *XrmValuePtr;<br />
</p></div><p>
The <span class="emphasis"><em>addr</em></span> field specifies the address of the data, and the <span class="emphasis"><em>size</em></span>
field gives the total number of significant bytes in the data.
For values of type
<code class="function">String</code>,
<span class="emphasis"><em>addr</em></span> is the address of the first character and <span class="emphasis"><em>size</em></span>
includes the NULL-terminating byte.
</p><p>
A resource converter procedure pointer is of type
<a class="xref" href="#XtTypeConverter"><code class="function">(*XtTypeConverter)</code></a>.
</p><div class="funcsynopsis"><a id="XtTypeConverter"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtTypeConverter)</strong>(</code>Display *<var class="pdparam">display</var>, XrmValue *<var class="pdparam">args</var>, Cardinal *<var class="pdparam">num_args</var>, XrmValue *<var class="pdparam">from</var>, XrmValue *<var class="pdparam">to</var>, XtPointer *<var class="pdparam">converter_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display connection with which this conversion is associated.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies a list of additional
<code class="function">XrmValue</code>
arguments to the converter if additional context is needed
to perform the conversion, or NULL.
For example, the String-to-Font converter needs the widget's <span class="emphasis"><em>display</em></span>,
and the String-to-Pixel converter needs the widget's <span class="emphasis"><em>screen</em></span> and <span class="emphasis"><em>colormap</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>args</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from</em></span>
</span></p></td><td><p>
Specifies the value to convert.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to</em></span>
</span></p></td><td><p>
Specifies a descriptor for a location into which to store the converted value.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter_data</em></span>
</span></p></td><td><p>
Specifies a location into which the converter may
store converter-specific data associated
with this conversion.
</p></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>display</em></span> argument is normally used only when generating error
messages, to identify the application context (with the function
<code class="function">XtDisplayToApplicationContext ).</code>
</p><p>
The <span class="emphasis"><em>to</em></span> argument specifies the size and location into which the
converter should store the converted value. If the <span class="emphasis"><em>addr</em></span> field is NULL,
the converter should allocate appropriate storage and store the size
and location into the <span class="emphasis"><em>to</em></span> descriptor. If the type converter allocates
the storage, it remains under the ownership of the converter and must
not be modified by the caller. The type converter is permitted to use
static storage for this purpose, and therefore the caller must
immediately copy the data upon return from the converter. If the
<span class="emphasis"><em>addr</em></span> field is not NULL, the converter must check the <span class="emphasis"><em>size</em></span> field to
ensure that sufficient space has been allocated before storing the
converted value. If insufficient space is specified, the converter
should update the <span class="emphasis"><em>size</em></span> field with the number of bytes required and
return
<code class="function">False</code>
without modifying the data at the specified location.
If sufficient space was allocated by the caller, the converter should
update the <span class="emphasis"><em>size</em></span> field with the number of bytes actually occupied by the
converted value. For converted values of type
<code class="function">XtRString</code>,
the size should
include the NULL-terminating byte, if any.
The converter may store any value in the location specified
in <span class="emphasis"><em>converter_data</em></span>; this value will be passed to the destructor, if any,
when the resource is freed by the Intrinsics.
</p><p>
The converter must return
<code class="function">True</code>
if the conversion was successful and
<code class="function">False</code>
otherwise. If the conversion cannot be performed because of an
improper source value, a warning message should also be issued with
<a class="xref" href="#XtAppWarningMsg"><code class="function">XtAppWarningMsg</code></a>.
</p><p>
Most type converters just take the data described by the specified <span class="emphasis"><em>from</em></span>
argument and return data by writing into the location specified in
the <span class="emphasis"><em>to</em></span> argument.
A few need other information, which is available in <span class="emphasis"><em>args</em></span>.
A type converter can invoke another type converter,
which allows differing sources that may convert into a common intermediate
result to make maximum use of the type converter cache.
</p><p>
Note that if an address is written into <span class="emphasis"><em>to->addr</em></span>, it cannot be that
of a local variable of the converter because the data will not be
valid after the converter returns. Static variables may be used,
as in the following example.
If the converter modifies the resource database,
the changes affect any in-progress widget creation,
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>,
or
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>
in an implementation-defined manner; however, insertion of new entries
or changes to existing entries is allowed and will not directly cause
an error.
</p><p>
The following is an example of a converter that takes a
<code class="function">string</code>
and converts it to a
<code class="function">Pixel</code>.
Note that the <span class="emphasis"><em>display</em></span> parameter is
used only to generate error messages; the
<code class="function">Screen</code>
conversion argument is
still required to inform the Intrinsics that the converted value is
a function of the particular display (and colormap).
</p><div class="literallayout"><p><br />
#define done(type, value) \\<br />
{ \\<br />
if (toVal->addr != NULL) { \\<br />
if (toVal->size < sizeof(type)) { \\<br />
toVal->size = sizeof(type); \\<br />
return False; \\<br />
} \\<br />
*(type*)(toVal->addr) = (value); \\<br />
} \\<br />
else { \\<br />
static type static_val; \\<br />
static_val = (value); \\<br />
toVal->addr = (XPointer)&static_val; \\<br />
} \\<br />
toVal->size = sizeof(type); \\<br />
return True; \\<br />
}<br />
static Boolean CvtStringToPixel(dpy, args, num_args, fromVal, toVal, converter_data)<br />
Display *dpy;<br />
XrmValue *args;<br />
Cardinal *num_args;<br />
XrmValue *fromVal;<br />
XrmValue *toVal;<br />
XtPointer *converter_data;<br />
{<br />
static XColor screenColor;<br />
XColor exactColor;<br />
Screen *screen;<br />
Colormap colormap;<br />
Status status;<br />
if (*num_args != 2)<br />
XtAppWarningMsg(XtDisplayToApplicationContext(dpy),<br />
"wrongParameters", "cvtStringToPixel", "XtToolkitError",<br />
"String to pixel conversion needs screen and colormap arguments",<br />
(String *)NULL, (Cardinal *)NULL);<br />
screen = *((Screen**) args[0].addr);<br />
colormap = *((Colormap *) args[1].addr);<br />
if (CompareISOLatin1(str, XtDefaultBackground) == 0) {<br />
*closure_ret = False;<br />
done(Pixel, WhitePixelOfScreen(screen));<br />
}<br />
if (CompareISOLatin1(str, XtDefaultForeground) == 0) {<br />
*closure_ret = False;<br />
done(Pixel, BlackPixelOfScreen(screen));<br />
}<br />
status = XAllocNamedColor(DisplayOfScreen(screen), colormap, (char*)fromVal->addr,<br />
&screenColor, &exactColor);<br />
if (status == 0) {<br />
String params[1];<br />
Cardinal num_params = 1;<br />
params[0] = (String)fromVal->addr;<br />
XtAppWarningMsg(XtDisplayToApplicationContext(dpy),<br />
"noColormap", "cvtStringToPixel", "XtToolkitError",<br />
"Cannot allocate colormap entry for \\"%s\\"", params,\<br />
&num_params);<br />
*converter_data = (char *) False;<br />
return False;<br />
} else {<br />
*converter_data = (char *) True;<br />
done(Pixel, &screenColor.pixel);<br />
}<br />
}<br />
</p></div><p>
All type converters should define some set of conversion values for which they
are guaranteed to succeed so these can be used in the resource defaults.
This issue arises only with conversions, such as fonts and colors,
where there is no string representation that all server implementations
will necessarily recognize.
For resources like these,
the converter should define a symbolic constant
in the same manner as
<code class="function">XtDefaultForeground</code>,
<code class="function">XtDefaultBackground</code>,
and
<code class="function">XtDefaultFont</code>.
</p><p>
To allow the Intrinsics to deallocate resources produced by type
converters, a resource destructor procedure may also be provided.
</p><p>
A resource destructor procedure pointer is of type
<a class="xref" href="#XtDestructor"><code class="function">(*XtDestructor)</code></a>.
</p><div class="funcsynopsis"><a id="XtDestructor"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtDestructor)</strong>(</code>XtAppContext <var class="pdparam">app</var>, XrmValue *<var class="pdparam">to</var>, XtPointer <var class="pdparam">converter_data</var>, XrmValue *<var class="pdparam">args</var>, Cardinal *<var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app</em></span>
</span></p></td><td><p>
Specifies an application context in which the resource is being freed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to</em></span>
</span></p></td><td><p>
Specifies a descriptor for the resource produced by the type converter.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter_data</em></span>
</span></p></td><td><p>
Specifies the converter-specific data returned by the type converter.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the additional converter arguments as passed
to the type converter when the conversion was performed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>args</em></span>.
</p></td></tr></tbody></table></div><p>
The destructor procedure is responsible for freeing the resource
specified by the <span class="emphasis"><em>to</em></span> argument, including any auxiliary storage
associated with that resource, but not the memory directly addressed
by the size and location in the <span class="emphasis"><em>to</em></span> argument or the memory specified
by <span class="emphasis"><em>args</em></span>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Issuing_Conversion_Warnings"></a>Issuing Conversion Warnings</h3></div></div></div><p>
The
<a class="xref" href="#XtDisplayStringConversionWarning"><code class="function">XtDisplayStringConversionWarning</code></a>
procedure is a convenience routine for resource type converters
that convert from string values.
</p><div class="funcsynopsis"><a id="XtDisplayStringConversionWarning"></a><p><code class="funcdef">void <strong class="fsfunc">XtDisplayStringConversionWarning</strong>(</code>Display *<var class="pdparam">display</var>, String <var class="pdparam">from_value</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display connection with which the conversion is associated.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from_value</em></span>
</span></p></td><td><p>
Specifies the string that could not be converted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_type</em></span>
</span></p></td><td><p>
Specifies the target representation type requested.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDisplayStringConversionWarning"><code class="function">XtDisplayStringConversionWarning</code></a>
procedure issues a warning message using
<a class="xref" href="#XtAppWarningMsg"><code class="function">XtAppWarningMsg</code></a>
with <span class="emphasis"><em>name</em></span> ``conversionError'',
<span class="emphasis"><em>type</em></span> ``string'', <span class="emphasis"><em>class</em></span> ``XtToolkitError'', and the default message
``Cannot convert "<span class="emphasis"><em>from_value</em></span>" to type <span class="emphasis"><em>to_type</em></span>''.
</p><p>
To issue other types of warning or error messages, the type converter
should use
<a class="xref" href="#XtAppWarningMsg"><code class="function">XtAppWarningMsg</code></a>
or
<a class="xref" href="#XtAppErrorMsg"><code class="function">XtAppErrorMsg</code></a>.
</p><p>
To retrieve the application context associated with a given
display connection, use
<a class="xref" href="#XtDisplayToApplicationContext"><code class="function">XtDisplayToApplicationContext</code></a>.
</p><div class="funcsynopsis"><a id="XtDisplayToApplicationContext"></a><p><code class="funcdef">XtAppContext <strong class="fsfunc">XtDisplayToApplicationContext</strong>(</code>Display *<var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies an open and initialized display connection.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDisplayToApplicationContext"><code class="function">XtDisplayToApplicationContext</code></a>
function returns the application
context in which the specified <span class="emphasis"><em>display</em></span> was initialized. If the
display is not known to the Intrinsics, an error message is issued.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Registering_a_New_Resource_Converter"></a>Registering a New Resource Converter</h3></div></div></div><p>
When registering a resource converter, the client must specify the
manner in which the conversion cache is to be used when there are multiple
calls to the converter. Conversion cache control is specified
via an <code class="function">XtCacheType</code>
argument. </p><div class="literallayout"><p><br />
typedef int XtCacheType;<br />
</p></div><p>
An <code class="function">XtCacheType</code>
field may contain one of the following values:
</p><p>
<code class="function">XtCacheNone</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Specifies that the results of a previous conversion
may not be reused to satisfy any other resource
requests; the specified converter will be called
each time the converted value is required.
</p></li></ul></div><p>
<code class="function">XtCacheAll</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Specifies that the results of a previous conversion
should be reused for any resource request that depends
upon the same source value and conversion arguments.
</p></li></ul></div><p>
<code class="function">XtCacheByDisplay</code>
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Specifies that the results of a previous conversion
should be used as for
<code class="function">XtCacheAll</code>
but the destructor will be called, if specified, if
<a class="xref" href="#XtCloseDisplay"><code class="function">XtCloseDisplay</code></a>
is called
for the display connection associated with the converted value, and
the value will be removed from the conversion cache.
</p></li></ul></div><p>
The qualifier
<code class="function">XtCacheRefCount</code>
may be ORed with any of the above values. If
<code class="function">XtCacheRefCount</code>
is specified, calls to
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>,
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>,
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>,
and
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>
that use the converted value will be counted. When a widget using the
converted value is destroyed, the count is decremented, and, if the
count reaches zero, the destructor procedure will be called and the
converted value will be removed from the conversion cache.
</p><p>
To register a type converter for all application contexts in a
process, use
<a class="xref" href="#XtSetTypeConverter"><code class="function">XtSetTypeConverter</code></a>,
and to register a type converter in a single application context, use
<a class="xref" href="#XtAppSetTypeConverter"><code class="function">XtAppSetTypeConverter</code></a>.
</p><div class="funcsynopsis"><a id="XtSetTypeConverter"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetTypeConverter</strong>(</code>String <var class="pdparam">from_type</var>, String <var class="pdparam">to_type</var>, XtTypeConverter <var class="pdparam">converter</var>, XtConvertArgList <var class="pdparam">convert_args</var>, Cardinal <var class="pdparam">num_args</var>, XtCacheType <var class="pdparam">cache_type</var>, XtDestructor <var class="pdparam">destructor</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>from_type</em></span>
</span></p></td><td><p>
Specifies the source type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_type</em></span>
</span></p></td><td><p>
Specifies the destination type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter</em></span>
</span></p></td><td><p>
Specifies the resource type converter procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>convert_args</em></span>
</span></p></td><td><p>
Specifies additional conversion arguments, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>convert_args</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>cache_type</em></span>
</span></p></td><td><p>
Specifies whether or not resources produced by this
converter are sharable or display-specific and when
they should be freed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>destructor</em></span>
</span></p></td><td><p>
Specifies a destroy procedure for resources produced by
this conversion, or NULL if no additional action is
required to deallocate resources produced by the converter.
</p></td></tr></tbody></table></div><div class="funcsynopsis"><a id="XtAppSetTypeConverter"></a><p><code class="funcdef"> <strong class="fsfunc">XtAppSetTypeConverter</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">from_type</var>, String <var class="pdparam">to_type</var>, XtTypeConverter <var class="pdparam">converter</var>, XtConvertArgList <var class="pdparam">convert_args</var>, Cardinal <var class="pdparam">num_args</var>, XtCacheType <var class="pdparam">cache_type</var>, XtDestructor <var class="pdparam">destructor</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from_type</em></span>
</span></p></td><td><p>
Specifies the source type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_type</em></span>
</span></p></td><td><p>
Specifies the destination type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter</em></span>
</span></p></td><td><p>
Specifies the resource type converter procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>convert_args</em></span>
</span></p></td><td><p>
Specifies additional conversion arguments, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>convert_args</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>cache_type</em></span>
</span></p></td><td><p>
Specifies whether or not resources produced by this
converter are sharable or display-specific and when
they should be freed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>destructor</em></span>
</span></p></td><td><p>
Specifies a destroy procedure for resources produced by
this conversion, or NULL if no additional action is
required to deallocate resources produced by the converter.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtSetTypeConverter"><code class="function">XtSetTypeConverter</code></a>
registers the specified type converter and
destructor in all application contexts created by the calling process,
including any future application contexts that may be created.
<a class="xref" href="#XtAppSetTypeConverter"><code class="function">XtAppSetTypeConverter</code></a>
registers the specified type converter in the
single application context specified. If the same <span class="emphasis"><em>from_type</em></span> and
<span class="emphasis"><em>to_type</em></span> are specified in multiple calls to either function, the most
recent overrides the previous ones.
</p><p>
For the few type converters that need additional arguments,
the Intrinsics conversion mechanism provides a method of specifying
how these arguments should be computed.
The enumerated type
<code class="function">XtAddressMode</code>
and the structure
<code class="function">XtConvertArgRec</code>
specify how each argument is derived.
These are defined in
<code class="function"><X11/Intrinsic.h></code>.
</p><div class="literallayout"><p><br />
typedef enum {<br />
/* address mode parameter representation */<br />
XtAddress, /* address */<br />
XtBaseOffset, /* offset */<br />
XtImmediate, /* constant */<br />
XtResourceString, /* resource name string */<br />
XtResourceQuark, /* resource name quark */<br />
XtWidgetBaseOffset, /* offset */<br />
XtProcedureArg /* procedure to call */<br />
} XtAddressMode;<br />
<br />
typedef struct {<br />
XtAddressMode address_mode;<br />
XtPointer address_id;<br />
Cardinal size;<br />
} XtConvertArgRec, *XtConvertArgList;<br />
</p></div><p>
The <span class="emphasis"><em>size</em></span> field specifies the length of the data in bytes.
The <span class="emphasis"><em>address_mode</em></span> field specifies how the <span class="emphasis"><em>address_id</em></span> field should be
interpreted.
<code class="function">XtAddress</code>
causes <span class="emphasis"><em>address_id</em></span> to be interpreted as the address of the data.
<code class="function">XtBaseOffset</code>
causes <span class="emphasis"><em>address_id</em></span> to be interpreted as the offset from the widget base.
<code class="function">XtImmediate</code>
causes <span class="emphasis"><em>address_id</em></span> to be interpreted as a constant.
<code class="function">XtResourceString</code>
causes <span class="emphasis"><em>address_id</em></span> to be interpreted as the name of a resource
that is to be converted into an offset from the widget base.
<code class="function">XtResourceQuark</code>
causes <span class="emphasis"><em>address_id</em></span> to be interpreted as the result of an
<code class="function">XrmStringToQuark</code>
conversion on the name of a resource,
which is to be converted into an offset from the widget base.
<code class="function">XtWidgetBaseOffset</code>
is similar to
<code class="function">XtBaseOffset</code>
except that it
searches for the closest windowed ancestor if the object is not
of a subclass of
Core
(see <a class="xref" href="#Nonwidget_Objects" title="Chapter 12. Nonwidget Objects">Chapter 12, <em>Nonwidget Objects</em></a>).
<code class="function">XtProcedureArg</code>
specifies that <span class="emphasis"><em>address_id</em></span> is a pointer to a procedure to
be invoked to return the conversion argument. If
<code class="function">XtProcedureArg</code>
is specified, <span class="emphasis"><em>address_id</em></span> must contain
the address of a function of type
<a class="xref" href="#XtConvertArgProc"><code class="function">(*XtConvertArgProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtConvertArgProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtConvertArgProc)</strong>(</code>XtAppContext <var class="pdparam">app</var>, XrmValue *<var class="pdparam">to</var>, XtPointer <var class="pdparam">converter_data</var>, XrmValue *<var class="pdparam">args</var>, Cardinal *<var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app</em></span>
</span></p></td><td><p>
Specifies an application context in which the resource is being freed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to</em></span>
</span></p></td><td><p>
Specifies a descriptor for the resource produced by the type converter.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter_data</em></span>
</span></p></td><td><p>
Specifies the converter-specific data returned by the type converter.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the additional converter arguments as passed
to the type converter when the conversion was performed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>args</em></span>.
</p></td></tr></tbody></table></div><p>
The destructor procedure is responsible for freeing the resource
specified by the <span class="emphasis"><em>to</em></span> argument, including any auxiliary storage
associated with that resource, but not the memory directly addressed
by the size and location in the <span class="emphasis"><em>to</em></span> argument or the memory specified
by <span class="emphasis"><em>args</em></span>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Resource_Converter_Invocation"></a>Resource Converter Invocation</h3></div></div></div><p>
All resource-fetching routines (for example,
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>,
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>,
and so on) call resource converters if the resource database or
varargs list specifies a value
that has a different representation from the desired representation or if the
widget's default resource value representation is different from the desired
representation.
</p><p>
To invoke explicit resource conversions, use
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>
or
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>.
</p><div class="literallayout"><p><br />
typedef XtPointer XtCacheRef;<br />
</p></div><div class="funcsynopsis"><a id="XtCallConverter"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtCallConverter</strong>(</code>Display* <var class="pdparam">display</var>, XtTypeConverter <var class="pdparam">converter</var>, XrmValuePtr <var class="pdparam">conversion_args</var>, Cardinal <var class="pdparam">num_args</var>, XrmValuePtr <var class="pdparam">from</var>, XrmValuePtr <var class="pdparam">to_in_out</var>, XtCacheRef *<var class="pdparam">cache_ref_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display with which the conversion is to be associated.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter</em></span>
</span></p></td><td><p>
Specifies the conversion procedure to be called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>conversion_args</em></span>
</span></p></td><td><p>
Specifies the additional conversion arguments needed
to perform the conversion, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>conversion_args</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from</em></span>
</span></p></td><td><p>
Specifies a descriptor for the source value.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_in_out</em></span>
</span></p></td><td><p>
Returns the converted value.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>cache_ref_return</em></span>
</span></p></td><td><p>
Returns a conversion cache id.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>
function looks up the
specified type converter in the application context associated with
the display and, if the converter was not registered or was registered
with cache type
<code class="function">XtCacheAll</code>
or
<code class="function">XtCacheByDisplay</code>,
looks in the conversion cache to see if this conversion procedure
has been called with the specified conversion arguments. If so, it
checks the success status of the prior call, and if
the conversion failed,
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>
returns
<code class="function">False</code>
immediately;
otherwise it checks the size specified in the <span class="emphasis"><em>to</em></span> argument, and, if it is
greater than or equal to the size stored in the cache, copies the
information stored in the cache into the location specified by
<span class="emphasis"><em>to->addr</em></span>, stores the cache size into <span class="emphasis"><em>to->size</em></span>, and returns
<code class="function">True</code>.
If the size specified in the <span class="emphasis"><em>to</em></span> argument is smaller than the size stored
in the cache,
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>
copies the cache size into <span class="emphasis"><em>to->size</em></span> and returns
<code class="function">False</code>.
If the converter was registered with cache type
<code class="function">XtCacheNone</code>
or no value was found in the conversion cache,
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>
calls the converter, and if it was not registered with cache type
<code class="function">XtCacheNone</code>,
enters the result in the cache.
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>
then returns what the converter returned.
</p><p>
The <span class="emphasis"><em>cache_ref_return</em></span> field specifies storage allocated by the caller in which
an opaque value will be stored. If the type converter has been
registered with the
<code class="function">XtCacheRefCount</code>
modifier and if the value returned
in <span class="emphasis"><em>cache_ref_return</em></span> is non-NULL, then the caller should store the
<span class="emphasis"><em>cache_ref_return</em></span> value in order to decrement the reference count when
the converted value is no longer required. The <span class="emphasis"><em>cache_ref_return</em></span>
argument should be
NULL if the caller is unwilling or unable to store the
value.
</p><p>
To explicitly decrement the reference counts for resources obtained
from
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>,
use
<a class="xref" href="#XtAppReleaseCacheRefs"><code class="function">XtAppReleaseCacheRefs</code></a>.
</p><div class="funcsynopsis"><a id="XtAppReleaseCacheRefs"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppReleaseCacheRefs</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtCacheRef *<var class="pdparam">refs</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>refs</em></span>
</span></p></td><td><p>
Specifies the list of cache references to be released.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppReleaseCacheRefs"><code class="function">XtAppReleaseCacheRefs</code></a>
decrements the reference count for the
conversion entries identified by the <span class="emphasis"><em>refs</em></span> argument.
This argument is a
pointer to a NULL-terminated list of
<code class="function">XtCacheRef</code>
values. If any reference
count reaches zero, the destructor, if any, will be called and
the resource removed from the conversion cache.
</p><p>
As a convenience to clients needing to explicitly decrement reference
counts via a callback function, the Intrinsics define two callback
procedures,
<a class="xref" href="#XtCallbackReleaseCacheRef"><code class="function">XtCallbackReleaseCacheRef</code></a>
and
<a class="xref" href="#XtCallbackReleaseCacheRefList"><code class="function">XtCallbackReleaseCacheRefList</code></a>.
</p><div class="funcsynopsis"><a id="XtCallbackReleaseCacheRef"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallbackReleaseCacheRef</strong>(</code>Widget <var class="pdparam">object</var>, XtPointer <var class="pdparam">client_data</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object with which the resource is associated.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the conversion cache entry to be released.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Is ignored.
</p></td></tr></tbody></table></div><p>
This callback procedure may be added to a callback list to release a
previously returned
<code class="function">XtCacheRef</code>
value. When adding the callback, the
callback <span class="emphasis"><em>client_data</em></span> argument must be specified as the value of the
<code class="function">XtCacheRef</code>
data cast to type
<code class="function">XtPointer</code>.
</p><div class="funcsynopsis"><a id="XtCallbackReleaseCacheRefList"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallbackReleaseCacheRefList</strong>(</code>Widget <var class="pdparam">object</var>, XtPointer <var class="pdparam">client_data</var>, XtPointer <var class="pdparam">call_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object with which the resources are associated.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the conversion cache entries to be released.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>call_data</em></span>
</span></p></td><td><p>
Is ignored.
</p></td></tr></tbody></table></div><p>
This callback procedure may be added to a callback list to release a
list of previously returned
<code class="function">XtCacheRef</code>
values. When adding the
callback, the callback <span class="emphasis"><em>client_data</em></span> argument must be specified as a
pointer to a NULL-terminated list of
<code class="function">XtCacheRef</code>
values.
</p><p>
To lookup and call a resource converter, copy the resulting value,
and free a cached resource when a widget is destroyed, use
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>.
</p><div class="funcsynopsis"><a id="XtConvertAndStore"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtConvertAndStore</strong>(</code>Widget <var class="pdparam">object</var>, String <var class="pdparam">from_type</var>, XrmValuePtr <var class="pdparam">from</var>, String <var class="pdparam">to_type</var>, XrmValuePtr <var class="pdparam">to_in_out</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object to use for additional arguments, if any are needed,
and the destroy callback list. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from_type</em></span>
</span></p></td><td><p>
Specifies the source type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from</em></span>
</span></p></td><td><p>
Specifies the value to be converted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_type</em></span>
</span></p></td><td><p>
Specifies the destination type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_in_out</em></span>
</span></p></td><td><p>
Specifies a descriptor for storage into which the converted value
will be returned.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>
function looks up the type converter registered
to convert <span class="emphasis"><em>from_type</em></span> to <span class="emphasis"><em>to_type</em></span>, computes any additional arguments
needed, and then calls
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>
(or
<a class="xref" href="#XtDirectConvert"><code class="function">XtDirectConvert</code></a>
if an old-style converter was registered with
<a class="xref" href="#XtAddConverter"><code class="function">XtAddConverter</code></a>
or
<a class="xref" href="#XtAppAddConverter"><code class="function">XtAppAddConverter</code></a>;
see Appendix C) with the <span class="emphasis"><em>from</em></span> and <span class="emphasis"><em>to_in_out</em></span> arguments. The
<span class="emphasis"><em>to_in_out</em></span> argument specifies the size and location into which the
converted value will be stored and is passed directly to the
converter. If the location is specified as NULL, it will be replaced
with a pointer to private storage and the size will be returned in the
descriptor. The caller is expected to copy this private storage
immediately and must not modify it in any way. If a non-NULL location
is specified, the caller must allocate sufficient storage to hold the
converted value and must also specify the size of that storage in the
descriptor.
The <span class="emphasis"><em>size</em></span> field will be modified on return to indicate the actual
size of the converted data.
If the conversion succeeds,
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>
returns
<code class="function">True</code>;
otherwise, it returns
<code class="function">False</code>.
</p><p>
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>
adds
<a class="xref" href="#XtCallbackReleaseCacheRef"><code class="function">XtCallbackReleaseCacheRef</code></a>
to the destroyCallback list of the specified object if the conversion
returns an
<code class="function">XtCacheRef</code>
value. The resulting resource should not be referenced
after the object has been destroyed.
</p><p>
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
performs processing equivalent to
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>
when initializing the object instance. Because there is extra memory
overhead required to implement reference counting, clients may
distinguish those objects that are never destroyed before the
application exits from those that may be destroyed and whose
resources should be deallocated.
</p><p>
To specify whether reference counting is to be enabled for the
resources of a particular object when the object is created, the
client can specify a value for the
<code class="function">Boolean</code>
resource
XtNinitialResourcesPersistent,
class
XtCInitialResourcesPersistent.
</p><p>
When
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
is called, if this resource is not specified as
<code class="function">False</code>
in either the arglist or the resource database, then the
resources referenced by this object are not reference-counted, regardless of
how the type converter may have been registered. The effective
default value is
<code class="function">True</code>;
thus clients that expect to destroy one or
more objects and want resources deallocated must explicitly specify
<code class="function">False</code>
for
XtNinitialResourcesPersistent.
</p><p>
The resources are still freed and destructors called when
<a class="xref" href="#XtCloseDisplay"><code class="function">XtCloseDisplay</code></a>
is called if the conversion was registered as
<code class="function">XtCacheByDisplay</code>.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Reading_and_Writing_Widget_State"></a>Reading and Writing Widget State</h2></div></div></div><p>
Any resource field in a widget can be read or written by a client.
On a write operation,
the widget decides what changes it will actually allow and updates all
derived fields appropriately.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Obtaining_Widget_State"></a>Obtaining Widget State</h3></div></div></div><p>
To retrieve the current values of resources associated with a
widget instance, use
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>.
</p><div class="funcsynopsis"><a id="XtGetValues"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetValues</strong>(</code>Widget <var class="pdparam">object</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object whose resource values are to be returned. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list of name/address pairs that contain the
resource names and the addresses into which the resource values are to
be stored.
The resource names are widget-dependent.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
function starts with the resources specified for the Object class
and proceeds down the subclass chain to the class of the object.
The <span class="emphasis"><em>value</em></span> field of a passed argument list must contain the
address into which to copy the contents of the corresponding
object instance field. If the field is a pointer type, the lifetime
of the pointed-to data is defined by the object class. For the
Intrinsics-defined resources, the following lifetimes apply:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Not valid following any operation that modifies the resource:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
XtNchildren resource of composite widgets.
</p></li><li class="listitem"><p>
All resources of representation type XtRCallback.
</p></li></ul></div></li><li class="listitem"><p>
Remain valid at least until the widget is destroyed:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
XtNaccelerators, XtNtranslations.
</p></li></ul></div></li><li class="listitem"><p>
Remain valid until the Display is closed:
</p></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: circle; "><li class="listitem"><p>
XtNscreen.
</p></li></ul></div></li></ul></div><p>
It is the caller's responsibility
to allocate and deallocate storage for the copied data
according to the size of the
resource representation type used within the object.
</p><p>
If the class of the object's parent is a subclass of
<code class="function">constraintWidgetClass</code>,
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
then fetches the values for any constraint resources requested.
It starts with the constraint resources specified for
<code class="function">constraintWidgetClass</code>
and proceeds down the subclass chain to the parent's constraint resources.
If the argument list contains a resource name that is not found in any of the
resource lists searched,
the value at the corresponding address is not modified.
If any get_values_hook procedures in the
object's class or superclass records are non-NULL,
they are called in superclass-to-subclass order after
all the resource values have been fetched by
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>.
Finally, if the object's parent is a
subclass of
<code class="function">constraintWidgetClass</code>,
and if any of the parent's class or
superclass records have declared
<code class="function">ConstraintClassExtension</code>
records in
the Constraint class part <span class="emphasis"><em>extension</em></span> field with a record type of
<span class="strong"><strong>NULLQUARK</strong></span>,
and if the <span class="emphasis"><em>get_values_hook</em></span> field in the extension record is non-NULL,
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
calls the get_values_hook procedures in superclass-to-subclass order.
This permits a Constraint parent to provide
nonresource data via
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>.
</p><p>
Get_values_hook procedures may modify the data stored at the
location addressed by the <span class="emphasis"><em>value</em></span> field, including (but not
limited to) making a copy of data whose resource representation is a
pointer. None of the Intrinsics-defined object classes copy
data in this manner. Any operation that modifies the queried
object resource may invalidate the pointed-to data.
</p><p>
To retrieve the current values of resources associated with a widget
instance using varargs lists, use
<a class="xref" href="#XtVaGetValues"><code class="function">XtVaGetValues</code></a>.
</p><div class="funcsynopsis"><a id="XtVaGetValues"></a><p><code class="funcdef">void <strong class="fsfunc">XtVaGetValues</strong>(</code>Widget <var class="pdparam">object</var>, <var class="pdparam">...</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object whose resource values are to be returned. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list for the resources to
be returned.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaGetValues"><code class="function">XtVaGetValues</code></a>
is identical in function to
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
with the <span class="emphasis"><em>args</em></span>
and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list, as described in
Section 2.5.1. All value entries in the list must specify pointers to
storage allocated by the caller to which the resource value will be
copied. It is the caller's responsibility to ensure that sufficient
storage is allocated. If
<code class="function">XtVaTypedArg</code>
is specified, the <span class="emphasis"><em>type</em></span> argument
specifies the representation desired by the caller and <span class="emphasis"><em>the</em></span> size argument
specifies the number of bytes allocated to store the result of the
conversion. If the size is insufficient, a warning message is issued
and the list entry is skipped.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Widget_Subpart_Resource_Data_The_get_values_hook_Procedure"></a>Widget Subpart Resource Data: The get_values_hook Procedure</h4></div></div></div><p>
Widgets that have subparts can return resource values from them through
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
by supplying a get_values_hook procedure.
The get_values_hook procedure pointer is of type
<a class="xref" href="#XtArgsProc"><code class="function">(*XtArgsProc)</code></a>.
</p><div class="funcsynopsis"><a id="_XtArgsProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtArgsProc)</strong>(</code>Widget <var class="pdparam">w</var>, ArgList <var class="pdparam">args</var>, Cardinal *<var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget whose subpart resource values are to be retrieved.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list that was passed to
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>
or the transformed varargs list passed to
<a class="xref" href="#XtVaGetValues"><code class="function">XtVaGetValues</code></a>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The widget with subpart resources should call
<a class="xref" href="#XtGetSubvalues"><code class="function">XtGetSubvalues</code></a>
in the get_values_hook procedure
and pass in its subresource list and the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Widget_Subpart_State"></a>Widget Subpart State</h4></div></div></div><p>
To retrieve the current values of subpart resource data associated with a
widget instance, use
<a class="xref" href="#XtGetSubvalues"><code class="function">XtGetSubvalues</code></a>.
For a discussion of subpart resources,
see <a class="xref" href="#Subresources" title="Subresources">the section called “Subresources”</a>.
</p><div class="funcsynopsis"><a id="XtGetSubvalues"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetSubvalues</strong>(</code>XtPointer <var class="pdparam">base</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address of the subpart data structure for which the
resources should be retrieved.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the subpart resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list of name/address pairs that contain the
resource names and the addresses into which the resource values are to
be stored.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetSubvalues"><code class="function">XtGetSubvalues</code></a>
function obtains resource values from the structure identified by <span class="emphasis"><em>base</em></span>.
The <span class="emphasis"><em>value</em></span> field in each argument entry must contain the address into
which to store the corresponding resource value. It is the caller's
responsibility to allocate and deallocate this storage according to
the size of the resource representation type used within the subpart.
If the argument list contains a resource name that is not found in the
resource list, the value at the corresponding address is not modified.
</p><p>
To retrieve the current values of subpart resources associated with
a widget instance using varargs lists, use
<a class="xref" href="#XtVaGetSubvalues"><code class="function">XtVaGetSubvalues</code></a>.
</p><div class="funcsynopsis"><a id="XtVaGetSubvalues"></a><p><code class="funcdef">void <strong class="fsfunc">XtVaGetSubvalues</strong>(</code>XtPointer <var class="pdparam">base</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var>, <var class="pdparam">...</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address of the subpart data structure for which the
resources should be retrieved.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the subpart resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies a variable argument list of name/address pairs that
contain the resource names and the addresses into which the resource
values are to be stored.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaGetSubvalues"><code class="function">XtVaGetSubvalues</code></a>
is identical in function to
<a class="xref" href="#XtGetSubvalues"><code class="function">XtGetSubvalues</code></a>
with the
<span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list, as described
in Section 2.5.1.
<code class="function">XtVaTypedArg</code>
is not supported for
<a class="xref" href="#XtVaGetSubvalues"><code class="function">XtVaGetSubvalues</code></a>.
If
<code class="function">XtVaTypedArg</code>
is specified in the list, a warning message is issued
and the entry is then ignored.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Setting_Widget_State"></a>Setting Widget State</h3></div></div></div><p>
To modify the current values of resources associated with a widget
instance, use
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>.
</p><div class="funcsynopsis"><a id="XtSetValues"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetValues</strong>(</code>Widget <var class="pdparam">object</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object whose resources are to be modified. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list of name/value pairs that contain the
resources to be modified and their new values.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
function starts with the resources specified for the
Object
class fields and proceeds down the subclass chain to the object.
At each stage, it replaces the <span class="emphasis"><em>object</em></span> resource fields with any values
specified in the argument list.
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
then calls the set_values procedures for the object in superclass-to-subclass
order.
If the object has any non-NULL <span class="emphasis"><em>set_values_hook</em></span> fields,
these are called immediately after the
corresponding set_values procedure.
This procedure permits subclasses to set subpart data via
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>.
</p><p>
If the class of the object's parent is a subclass of
<code class="function">constraintWidgetClass</code>,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
also updates the object's constraints.
It starts with the constraint resources specified for
<code class="function">constraintWidgetClass</code>
and proceeds down the subclass chain to the parent's class.
At each stage, it replaces the constraint resource fields with any
values specified in the argument list.
It then calls the constraint set_values procedures from
<code class="function">constraintWidgetClass</code>
down to the parent's class.
The constraint set_values procedures are called with widget arguments,
as for all set_values procedures, not just the constraint records,
so that they can make adjustments to the desired values based
on full information about the widget. Any arguments specified that
do not match a resource list entry are silently ignored.
</p><p>
If the object is of a subclass of
RectObj,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
determines if a geometry request is needed by comparing the old object to
the new object.
If any geometry changes are required,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
restores the original geometry and makes the request on behalf of the widget.
If the geometry manager returns
<code class="function">XtGeometryYes</code>,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
calls the object's resize procedure.
If the geometry manager returns
<code class="function">XtGeometryDone</code>,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
continues, as the object's resize procedure should have been called
by the geometry manager.
If the geometry manager returns
<code class="function">XtGeometryNo</code>,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
ignores the geometry request and continues.
If the geometry manager returns
<code class="function">XtGeometryAlmost</code>,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
calls the set_values_almost procedure,
which determines what should be done.
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
then repeats this process,
deciding once more whether the geometry manager should be called.
</p><p>
Finally, if any of the set_values procedures returned
<code class="function">True</code>,
and the widget is realized,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
causes the widget's expose procedure to be invoked by calling
<code class="function">XClearArea</code>
on the widget's window.
</p><p>
To modify the current values of resources associated with a widget
instance using varargs lists, use
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>.
</p><div class="funcsynopsis"><a id="XtVaSetValues"></a><p><code class="funcdef">void <strong class="fsfunc">XtVaSetValues</strong>(</code>Widget <var class="pdparam">object</var>, <var class="pdparam">...</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies the object whose resources are to be modified. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list of name/value pairs that
contain the resources to be modified and their new values.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>
is identical in function to
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list, as
described in Section 2.5.1.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Widget_State_The_set_values_Procedure"></a>Widget State: The set_values Procedure</h4></div></div></div><p>
The set_values procedure pointer in a widget class is of type
<a class="xref" href="#XtSetValuesFunc"><code class="function">(*XtSetValuesFunc)</code></a>.
</p><div class="funcsynopsis"><a id="XtSetValuesFunc"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtSetValuesFunc)</strong>(</code>Widget <var class="pdparam">current</var>, Widget <var class="pdparam">request</var>, Widget <var class="pdparam">new</var>, ArgList <var class="pdparam">args</var>, Cardinal *<var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>current</em></span>
</span></p></td><td><p>
Specifies a copy of the widget as it was before the
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
call.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request</em></span>
</span></p></td><td><p>
Specifies a copy of the widget with all values changed as asked for by the
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
call before any class set_values procedures have been called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>new</em></span>
</span></p></td><td><p>
Specifies the widget with the new values that are actually allowed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list passed to
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
or the transformed argument list passed to
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The set_values procedure should recompute any field
derived from resources that are changed
(for example, many GCs depend on foreground and background pixels).
If no recomputation is necessary, and if none of the resources specific to a
subclass require the window to be redisplayed when their values are changed,
you can specify NULL for the <span class="emphasis"><em>set_values</em></span> field in the class record.
</p><p>
Like the initialize procedure,
set_values mostly deals only with the fields defined in the subclass,
but it has to resolve conflicts with its superclass,
especially conflicts over width and height.
</p><p>
Sometimes a subclass may want to overwrite values filled in by its
superclass.
In particular, size calculations of a superclass are often
incorrect for a subclass, and, in this case,
the subclass must modify or recalculate fields declared
and computed by its superclass.
</p><p>
As an example,
a subclass can visually surround its superclass display.
In this case, the width and height calculated by the superclass set_values
procedure are too small and need to be incremented by the size of the surround.
The subclass needs to know if its superclass's size was calculated by the
superclass or was specified explicitly.
All widgets must place themselves into whatever size is explicitly given,
but they should compute a reasonable size if no size is requested.
How does a subclass know the difference between a specified size
and a size computed by a superclass?
</p><p>
The <span class="emphasis"><em>request</em></span> and <span class="emphasis"><em>new</em></span> parameters provide the necessary information.
The <span class="emphasis"><em>request</em></span> widget is a copy of the widget, updated as originally requested.
The <span class="emphasis"><em>new</em></span> widget starts with the values in the request,
but it has additionally been updated by all superclass set_values
procedures called so far.
A subclass set_values procedure can compare these two to resolve
any potential conflicts.
The set_values procedure need not refer to the <span class="emphasis"><em>request</em></span> widget
unless it must resolve conflicts between the <span class="emphasis"><em>current</em></span> and <span class="emphasis"><em>new</em></span> widgets.
Any changes the widget needs to make, including geometry changes,
should be made in the <span class="emphasis"><em>new</em></span> widget.
</p><p>
In the above example,
the subclass with the visual surround can see
if the <span class="emphasis"><em>width</em></span> and <span class="emphasis"><em>height</em></span> in the <span class="emphasis"><em>request</em></span> widget are zero.
If so,
it adds its surround size to the <span class="emphasis"><em>width</em></span> and
<span class="emphasis"><em>height</em></span> fields in the <span class="emphasis"><em>new</em></span> widget.
If not, it must make do with the size originally specified.
In this case, zero is a special value defined by the class to permit
the application to invoke this behavior.
</p><p>
The <span class="emphasis"><em>new</em></span> widget is the actual widget instance record.
Therefore,
the set_values procedure should do all its work on the <span class="emphasis"><em>new</em></span> widget;
the <span class="emphasis"><em>request</em></span> widget should never be modified.
If the set_values procedure needs to call any routines that operate on
a widget, it should specify <span class="emphasis"><em>new</em></span> as the widget instance.
</p><p>
Before calling the set_values procedures, the Intrinsics modify the
resources of the <span class="emphasis"><em>request</em></span> widget according to the contents of the arglist;
if the widget names all its resources in the class resource list, it is
never necessary to examine the contents of <span class="emphasis"><em>args</em></span>.
</p><p>
Finally, the set_values procedure must return a Boolean that indicates whether
the widget needs to be redisplayed.
Note that a change in the geometry fields alone does not require
the set_values procedure to return
<code class="function">True</code>;
the X server will eventually generate an
<code class="function">Expose</code>
event, if necessary.
After calling all the set_values procedures,
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
forces a redisplay by calling
<code class="function">XClearArea</code>
if any of the set_values procedures returned
<code class="function">True</code>.
Therefore, a set_values procedure should not try to do its own redisplaying.
</p><p>
Set_values procedures should not do any work in response to changes in
geometry because
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
eventually will perform a geometry request, and that request might be denied.
If the widget actually changes size in response to a
call to
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>,
its resize procedure is called.
Widgets should do any geometry-related work in their resize procedure.
</p><p>
Note that it is permissible to call
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
before a widget is realized.
Therefore, the set_values procedure must not assume that the widget is realized.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Widget_State_The_set_values_almost_Procedure"></a>Widget State: The set_values_almost Procedure</h4></div></div></div><p>
The set_values_almost procedure pointer in the widget class record is of type
<a class="xref" href="#XtAlmostProc"><code class="function">(*XtAlmostProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtAlmostProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtAlmostProc)</strong>(</code>Widget <var class="pdparam">old</var>, Widget <var class="pdparam">new</var>, XtWidgetGeometry *<var class="pdparam">request</var>, XtWidgetGeometry *<var class="pdparam">reply</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>old</em></span>
</span></p></td><td><p>
Specifies a copy of the object as it was before the
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
call.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>new</em></span>
</span></p></td><td><p>
Specifies the object instance record.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request</em></span>
</span></p></td><td><p>
Specifies the original geometry request that was sent to the geometry
manager that caused
<code class="function">XtGeometryAlmost</code>
to be returned.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>reply</em></span>
</span></p></td><td><p>
Specifies the compromise geometry that was returned by the geometry
manager with
<code class="function">XtGeometryAlmost</code>.
</p></td></tr></tbody></table></div><p>
Most classes inherit the set_values_almost procedure from their superclass by
specifying
<code class="function">XtInheritSetValuesAlmost</code>
in the class initialization.
The
set_values_almost procedure in
<code class="function">rectObjClass</code>
accepts the compromise suggested.
</p><p>
The set_values_almost procedure is called when a client tries to set a widget's
geometry by means of a call to
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
and the geometry manager cannot
satisfy the request but instead returns
<code class="function">XtGeometryNo</code>
or
<code class="function">XtGeometryAlmost</code>
and a compromise geometry.
The <span class="emphasis"><em>new</em></span> object is the actual instance record. The <span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>,
<span class="emphasis"><em>width</em></span>, <span class="emphasis"><em>height</em></span>,
and <span class="emphasis"><em>border_width</em></span> fields contain the original values as they were
before the
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
call, and all other fields contain the new
values. The <span class="emphasis"><em>request</em></span> parameter contains the new geometry request that
was made to the parent. The <span class="emphasis"><em>reply</em></span> parameter contains
<span class="emphasis"><em>reply->request_mode</em></span> equal to zero if the parent returned
<code class="function">XtGeometryNo</code>
and contains the parent's compromise geometry otherwise. The
set_values_almost procedure takes the original geometry and the
compromise geometry and determines if the compromise is
acceptable or whether
to try a different compromise.
It returns its results in the <span class="emphasis"><em>request</em></span> parameter,
which is then sent back to the geometry manager for another try.
To accept the compromise, the procedure must copy the contents
of the <span class="emphasis"><em>reply</em></span> geometry into the <span class="emphasis"><em>request</em></span> geometry; to attempt an
alternative geometry, the procedure may modify any part of the <span class="emphasis"><em>request</em></span>
argument; to terminate the geometry negotiation and retain the
original geometry, the procedure must set <span class="emphasis"><em>request->request_mode</em></span> to
zero. The geometry fields of the <span class="emphasis"><em>old</em></span> and <span class="emphasis"><em>new</em></span> instances must not be modified
directly.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Widget_State_The_ConstraintClassPart_set_values_Procedure"></a>Widget State: The ConstraintClassPart set_values Procedure</h4></div></div></div><p>
The constraint set_values procedure pointer is of type
<a class="xref" href="#XtSetValuesFunc"><code class="function">(*XtSetValuesFunc)</code></a>.
The values passed to the parent's constraint set_values procedure
are the same as those passed to the child's class
set_values procedure.
A class can specify NULL for the <span class="emphasis"><em>set_values</em></span> field of the
<code class="function">ConstraintPart</code>
if it need not compute anything.
</p><p>
The constraint set_values procedure should recompute any constraint fields
derived from constraint resources that are changed.
Furthermore, it may modify other widget fields as appropriate.
For example, if a constraint for the maximum height of a widget is changed
to a value smaller than the widget's current height,
the constraint set_values procedure may reset the <span class="emphasis"><em>height</em></span> field in the
widget.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Widget_Subpart_State_2"></a>Widget Subpart State</h4></div></div></div><p>
To set the current values of subpart resources associated with a
widget instance, use
<a class="xref" href="#XtSetSubvalues"><code class="function">XtSetSubvalues</code></a>.
For a discussion of subpart resources,
see <a class="xref" href="#Subresources" title="Subresources">the section called “Subresources”</a>.
</p><div class="funcsynopsis"><a id="XtSetSubvalues"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetSubvalues</strong>(</code>XtPointer <var class="pdparam">base</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address of the subpart data structure into which the
resources should be written.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the subpart resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list of name/value pairs that contain the
resources to be modified and their new values.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtSetSubvalues"><code class="function">XtSetSubvalues</code></a>
function updates the resource fields of the structure identified by
<span class="emphasis"><em>base</em></span>. Any specified arguments that do not match an entry in the
resource list are silently ignored.
</p><p>
To set the current values of subpart resources associated with
a widget instance using varargs lists, use
<a class="xref" href="#XtVaSetSubvalues"><code class="function">XtVaSetSubvalues</code></a>.
</p><div class="funcsynopsis"><a id="XtVaSetSubvalues"></a><p><code class="funcdef">void <strong class="fsfunc">XtVaSetSubvalues</strong>(</code>XtPointer <var class="pdparam">base</var>, XtResourceList <var class="pdparam">resources</var>, Cardinal <var class="pdparam">num_resources</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>base</em></span>
</span></p></td><td><p>
Specifies the base address of the subpart data structure into which the
resources should be written.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>resources</em></span>
</span></p></td><td><p>
Specifies the subpart resource list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_resources</em></span>
</span></p></td><td><p>
Specifies the number of entries in the resource list.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list of name/value pairs that
contain the resources to be modified and their new values.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtVaSetSubvalues"><code class="function">XtVaSetSubvalues</code></a>
is identical in function to
<a class="xref" href="#XtSetSubvalues"><code class="function">XtSetSubvalues</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list, as
described in Section 2.5.1.
<code class="function">XtVaTypedArg</code>
is not supported for
<a class="xref" href="#XtVaSetSubvalues"><code class="function">XtVaSetSubvalues</code></a>.
If an entry containing
<code class="function">XtVaTypedArg</code>
is specified in the list, a warning message is issued
and the entry is ignored.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Widget_Subpart_Resource_Data_The_set_values_hook_Procedure"></a>Widget Subpart Resource Data: The set_values_hook Procedure</h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
The set_values_hook procedure is obsolete, as the same information
is now available to the set_values procedure. The procedure has been
retained for those widgets that used it in versions prior to Release 4.
</p></div><p>
Widgets that have a subpart can set the subpart resource values through
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
by supplying a set_values_hook procedure.
The set_values_hook procedure pointer in a widget class is of type
<a class="xref" href="#XtArgsFunc"><code class="function">(*XtArgsFunc)</code></a>.
</p><div class="funcsynopsis"><a id="XtArgsFunc"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtArgsFunc)</strong>(</code>Widget <var class="pdparam">w</var>, Arglist <var class="pdparam">args</var>, Cardinal *<var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget whose subpart resource values are to be changed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list that was passed to
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
or the transformed varargs list passed to
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The widget with subpart resources may call
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
from the set_values_hook procedure
and pass in its subresource list and the
<span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters.
</p></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Translation_Management"></a>Chapter 10. Translation Management</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Action_Tables">Action Tables</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Action_Table_Registration">Action Table Registration</a></span></dt><dt><span class="sect2"><a href="#Action_Names_to_Procedure_Translations">Action Names to Procedure Translations</a></span></dt><dt><span class="sect2"><a href="#Action_Hook_Registration">Action Hook Registration</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Translation_Tables">Translation Tables</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Event_Sequences">Event Sequences</a></span></dt><dt><span class="sect2"><a href="#Action_Sequences">Action Sequences</a></span></dt><dt><span class="sect2"><a href="#Multi_Click_Time">Multi-Click Time</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Translation_Table_Management">Translation Table Management</a></span></dt><dt><span class="sect1"><a href="#Using_Accelerators">Using Accelerators</a></span></dt><dt><span class="sect1"><a href="#KeyCode_to_KeySym_Conversions">KeyCode-to-KeySym Conversions</a></span></dt><dt><span class="sect1"><a href="#Obtaining_a_KeySym_in_an_Action_Procedure">Obtaining a KeySym in an Action Procedure</a></span></dt><dt><span class="sect1"><a href="#KeySym_to_KeyCode_Conversions">KeySym-to-KeyCode Conversions</a></span></dt><dt><span class="sect1"><a href="#Registering_Button_and_Key_Grabs_for_Actions">Registering Button and Key Grabs for Actions</a></span></dt><dt><span class="sect1"><a href="#Invoking_Actions_Directly">Invoking Actions Directly</a></span></dt><dt><span class="sect1"><a href="#Obtaining_a_Widget_s_Action_List">Obtaining a Widget's Action List</a></span></dt></dl></div><p>
Except under unusual circumstances,
widgets do not hardwire the mapping of user events into widget behavior
by using the event manager.
Instead, they provide a default mapping of events into behavior
that you can override.
</p><p>
The translation manager provides an interface to specify and manage the
mapping of X event sequences into widget-supplied functionality,
for example, calling procedure <span class="emphasis"><em>Abc</em></span> when the <span class="emphasis"><em>y</em></span> key
is pressed.
</p><p>
The translation manager uses two kinds of tables to perform translations:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
The action tables, which are in the widget class structure,
specify the mapping of externally available procedure name strings
to the corresponding procedure implemented by the widget class.
</p></li><li class="listitem"><p>
A translation table, which is in the widget class structure,
specifies the mapping of event sequences to procedure name strings.
</p></li></ul></div><p>
You can override the translation table in the class structure
for a specific widget instance by supplying a different translation table
for the widget instance. The resources
XtNtranslations and XtNbaseTranslations are used to modify the class
default translation table; see <a class="xref" href="#Translation_Table_Management" title="Translation Table Management">the section called “Translation Table Management”</a>.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Action_Tables"></a>Action Tables</h2></div></div></div><p>
All widget class records contain an action table,
an array of
<code class="function">XtActionsRec</code>
entries.
In addition,
an application can register its own action tables with the translation manager
so that the translation tables it provides to widget instances can access
application functionality directly.
The translation action procedure pointer is of type
<a class="xref" href="#XtActionProc"><code class="function">(*XtActionProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtActionProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtActionProc)</strong>(</code>Widget <var class="pdparam">w</var>, XEvent *<var class="pdparam">event</var>, String *<var class="pdparam">params</var>, Cardinal *<var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that caused the action to be called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies the event that caused the action to be called.
If the action is called after a sequence of events,
then the last event in the sequence is used.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies a pointer to the list of strings that were specified
in the translation table as arguments to the action, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><div class="literallayout"><p><br />
typedef struct _XtActionsRec {<br />
String string;<br />
XtActionProc proc;<br />
} XtActionsRec, *XtActionList;<br />
</p></div><p>
The <span class="emphasis"><em>string</em></span> field is the name used in translation tables to access
the procedure.
The <span class="emphasis"><em>proc</em></span> field is a pointer to a procedure that implements
the functionality.
</p><p>
When the action list is specified as the
<code class="function">CoreClassPart</code>
<span class="emphasis"><em>actions</em></span> field, the string pointed to by <span class="emphasis"><em>string</em></span> must be
permanently allocated prior to or during the execution of the class
initialization procedure and must not be subsequently deallocated.
</p><p>
Action procedures should not assume that the widget in which they
are invoked is realized; an accelerator specification can cause
an action procedure to be called for a widget that does not yet
have a window. Widget writers should also note which of a widget's
callback lists are invoked from action procedures and warn clients
not to assume the widget is realized in those callbacks.
</p><p>
For example, a Pushbutton widget has procedures to take the following actions:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Set the button to indicate it is activated.
</p></li><li class="listitem"><p>
Unset the button back to its normal mode.
</p></li><li class="listitem"><p>
Highlight the button borders.
</p></li><li class="listitem"><p>
Unhighlight the button borders.
</p></li><li class="listitem"><p>
Notify any callbacks that the button has been activated.
</p></li></ul></div><p>
The action table for the Pushbutton widget class makes these functions
available to translation tables written for Pushbutton or any subclass.
The string entry is the name used in translation tables.
The procedure entry (usually spelled identically to the string)
is the name of the C procedure that implements that function:
</p><div class="literallayout"><p><br />
XtActionsRec actionTable[] = {<br />
{"Set", Set},<br />
{"Unset", Unset},<br />
{"Highlight", Highlight},<br />
{"Unhighlight", Unhighlight}<br />
{"Notify", Notify},<br />
};<br />
</p></div><p>
The Intrinsics reserve all action names and parameters starting with
the characters ``Xt'' for future standard enhancements. Users,
applications, and widgets should not declare action names or pass
parameters starting with these characters except to invoke specified
built-in Intrinsics functions.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Action_Table_Registration"></a>Action Table Registration</h3></div></div></div><p>
The <span class="emphasis"><em>actions</em></span> and <span class="emphasis"><em>num_actions</em></span> fields of
<code class="function">CoreClassPart</code>
specify the actions implemented by a widget class. These are
automatically registered with the Intrinsics when the class is initialized
and must be allocated in writable storage prior to Core class_part
initialization, and never deallocated. To save memory and optimize
access, the Intrinsics may overwrite the storage in order to compile the
list into an internal representation.
</p><p>
To declare an action table within an application
and register it with the translation manager, use
<a class="xref" href="#XtAppAddActions"><code class="function">XtAppAddActions</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddActions"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppAddActions</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtActionList <var class="pdparam">actions</var>, Cardinal <var class="pdparam">num_actions</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>actions</em></span>
</span></p></td><td><p>
Specifies the action table to register.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_actions</em></span>
</span></p></td><td><p>
Specifies the number of entries in this action table.
</p></td></tr></tbody></table></div><p>
If more than one action is registered with the same name,
the most recently registered action is used.
If duplicate actions exist in an action table,
the first is used.
The Intrinsics register an action table containing
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
and
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>
as part of
<a class="xref" href="#XtCreateApplicationContext"><code class="function">XtCreateApplicationContext</code></a>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Action_Names_to_Procedure_Translations"></a>Action Names to Procedure Translations</h3></div></div></div><p>
The translation manager uses a simple algorithm to resolve the name of
a procedure specified in a translation table into the
actual procedure specified
in an action table.
When the widget
is realized, the translation manager
performs a search for the name in the following tables, in order:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
The widget's class and all superclass action tables, in subclass-to-superclass
order.
</p></li><li class="listitem"><p>
The parent's class and all superclass action tables, in subclass-to-superclass
order, then on up the ancestor tree.
</p></li><li class="listitem"><p>
The action tables registered with
<a class="xref" href="#XtAppAddActions"><code class="function">XtAppAddActions</code></a>
and
<a class="xref" href="#XtAddActions"><code class="function">XtAddActions</code></a>
from the most recently added table to the oldest table.
</p></li></ul></div><p>
As soon as it finds a name,
the translation manager stops the search.
If it cannot find a name,
the translation manager generates a warning message.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Action_Hook_Registration"></a>Action Hook Registration</h3></div></div></div><p>
An application can specify a procedure that will be called just before
every action routine is dispatched by the translation manager. To do
so, the application supplies a procedure pointer of type
<a class="xref" href="#XtActionHookProc"><code class="function">(*XtActionHookProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtActionHookProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtActionHookProc)</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, String <var class="pdparam">action_name</var>, XEvent* <var class="pdparam">event</var>, String* <var class="pdparam">params</var>, Cardinal* <var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget whose action is about to be dispatched.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the application-specific closure that was passed to
<code class="function">XtAppAddActionHook.</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>action_name</em></span>
</span></p></td><td><p>
Specifies the name of the action to be dispatched.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies the event argument that will be passed to the action routine.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies the action parameters that will be passed to the action routine.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><p>
Action hooks should not modify any of the data pointed to by the
arguments other than the <span class="emphasis"><em>client_data</em></span> argument.
</p><p>
To add an action hook, use
<a class="xref" href="#XtAppAddActionHook"><code class="function">XtAppAddActionHook</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddActionHook"></a><p><code class="funcdef">XtActionHookId <strong class="fsfunc">XtAppAddActionHook</strong>(</code>XtAppContext <var class="pdparam">app</var>, XtActionHookProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the action hook procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies application-specific data to be passed to the action hook.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppAddActionHook"><code class="function">XtAppAddActionHook</code></a>
adds the specified procedure to the front of a list
maintained in the application context. In the future, when an action
routine is about to be invoked for any widget in this application
context, either through the translation manager or via
<a class="xref" href="#XtCallActionProc"><code class="function">XtCallActionProc</code></a>,
the action hook procedures will be called in reverse
order of registration just prior to invoking the action routine.
</p><p>
Action hook procedures are removed automatically and the
<code class="function">XtActionHookId is</code>
destroyed when the application context in which
they were added is destroyed.
</p><p>
To remove an action hook procedure without destroying the application
context, use
<a class="xref" href="#XtRemoveActionHook"><code class="function">XtRemoveActionHook</code></a>.
</p><div class="funcsynopsis"><a id="XtRemoveActionHook"></a><p><code class="funcdef">void <strong class="fsfunc">XtRemoveActionHook</strong>(</code>XtActionHookId <var class="pdparam">id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>id</em></span>
</span></p></td><td><p>
Specifies the action hook id returned by
<a class="xref" href="#XtAppAddActionHook"><code class="function">XtAppAddActionHook</code></a>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtRemoveActionHook"><code class="function">XtRemoveActionHook</code></a>
removes the specified action hook procedure from
the list in which it was registered.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Translation_Tables"></a>Translation Tables</h2></div></div></div><p>
All widget instance records contain a translation table,
which is a resource with a default value specified elsewhere in the
class record.
A translation table specifies what action procedures are invoked for
an event or a sequence of events.
A translation table
is a string containing a list of translations from an event sequence
into one or more action procedure calls.
The translations are separated from one another by newline characters
(ASCII LF).
The complete syntax of translation tables is specified in Appendix B.
</p><p>
As an example, the default behavior of Pushbutton is
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Highlight on enter window.
</p></li><li class="listitem"><p>
Unhighlight on exit window.
</p></li><li class="listitem"><p>
Invert on left button down.
</p></li><li class="listitem"><p>
Call callbacks and reinvert on left button up.
</p></li></ul></div><p>
The following illustrates Pushbutton's default translation table:
</p><div class="literallayout"><p><br />
static String defaultTranslations =<br />
"<EnterWindow>: Highlight()\\n\\<br />
<LeaveWindow>: Unhighlight()\\n\\<br />
<Btn1Down>: Set()\\n\\<br />
<Btn1Up>: Notify() Unset()";<br />
</p></div><p>
The <span class="emphasis"><em>tm_table</em></span> field of the
<code class="function">CoreClassPart</code>
should be filled in at class initialization time with
the string containing the class's default translations.
If a class wants to inherit its superclass's translations,
it can store the special value
<code class="function">XtInheritTranslations</code>
into <span class="emphasis"><em>tm_table</em></span>.
In Core's class part initialization procedure,
the Intrinsics compile this translation table into an efficient internal form.
Then, at widget creation time,
this default translation table is
combined with the XtNtranslations
and XtNbaseTranslations resources; see
<a class="xref" href="#Translation_Table_Management" title="Translation Table Management">the section called “Translation Table Management”</a>.
</p><p>
The resource conversion mechanism automatically compiles
string translation tables that are specified in the resource database.
If a client uses translation tables that are not retrieved via a
resource conversion,
it must compile them itself using
<a class="xref" href="#XtParseTranslationTable"><code class="function">XtParseTranslationTable</code></a>.
</p><p>
The Intrinsics use the compiled form of the translation table to register the
necessary events with the event manager.
Widgets need do nothing other than specify the action and translation tables
for events to be processed by the translation manager.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Event_Sequences"></a>Event Sequences</h3></div></div></div><p>
An event sequence is a comma-separated list of X event descriptions
that describes a specific sequence of X events to map to a set of
program actions.
Each X event description consists of three parts:
The X event type, a prefix consisting of the X modifier bits, and
an event-specific suffix.
</p><p>
Various abbreviations are supported to make translation tables easier
to read. The events must match incoming events in left-to-right order
to trigger the action sequence.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Action_Sequences"></a>Action Sequences</h3></div></div></div><p>
Action sequences specify what program or widget actions to take in response to
incoming X events. An action sequence consists of space-separated
action procedure call specifications.
Each action procedure call consists of the name of an action procedure and a
parenthesized list of zero or more comma-separated
string parameters to pass to that procedure.
The actions are invoked in left-to-right order as specified in the
action sequence.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Multi_Click_Time"></a>Multi-Click Time</h3></div></div></div><p>
Translation table entries may specify actions that are taken when two
or more identical events occur consecutively within a short time
interval, called the multi-click time. The multi-click time value may
be specified as an application resource with name ``multiClickTime'' and
class ``MultiClickTime'' and may also be modified dynamically by the
application. The multi-click time is unique for each Display value and
is retrieved from the resource database by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>.
If no value is specified, the initial value is 200 milliseconds.
</p><p>
To set the multi-click time dynamically, use
<a class="xref" href="#XtSetMultiClickTime"><code class="function">XtSetMultiClickTime</code></a>.
</p><div class="funcsynopsis"><a id="XtSetMultiClickTime"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetMultiClickTime</strong>(</code>Display *<var class="pdparam">display</var>, int <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display connection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the multi-click time in milliseconds.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtSetMultiClickTime"><code class="function">XtSetMultiClickTime</code></a>
sets the time interval used by the translation
manager to determine when multiple events are interpreted as a
repeated event. When a repeat count is specified in a translation
entry, the interval between the timestamps in each pair of repeated
events (e.g., between two
<code class="function">ButtonPress</code>
events) must be less than the
multi-click time in order for the translation actions to be taken.
</p><p>
To read the multi-click time, use
<a class="xref" href="#XtGetMultiClickTime"><code class="function">XtGetMultiClickTime</code></a>.
</p><div class="funcsynopsis"><a id="XtGetMultiClickTime"></a><p><code class="funcdef">int <strong class="fsfunc">XtGetMultiClickTime</strong>(</code>Display *<var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display connection.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGetMultiClickTime"><code class="function">XtGetMultiClickTime</code></a>
returns the time in milliseconds that the
translation manager uses to determine if multiple events are to be
interpreted as a repeated event for purposes of matching a translation
entry containing a repeat count.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Translation_Table_Management"></a>Translation Table Management</h2></div></div></div><p>
Sometimes an application needs to merge
its own translations with a widget's translations.
For example, a window manager provides functions to move a window.
The window manager wishes to bind this operation to a specific
pointer button in the title bar without the possibility of user
override and bind it to other buttons that may be overridden by the user.
</p><p>
To accomplish this,
the window manager should first create the title bar
and then should merge the two translation tables into
the title bar's translations.
One translation table contains the translations that the window manager
wants only if the user has not specified a translation for a particular event
or event sequence (i.e., those that may be overridden).
The other translation table contains the translations that the
window manager wants regardless of what the user has specified.
</p><p>
Three Intrinsics functions support this merging:
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>XtParseTranslationTable</em></span>
</span></p></td><td><p>Compiles a translation table.</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>XtAugmentTranslations</em></span>
</span></p></td><td><p>Merges a compiled translation table into a widget's
compiled translation table, ignoring any new translations that
conflict with existing translations.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>XtOverrideTranslations</em></span>
</span></p></td><td><p>Merges a compiled translation table into a widget's
compiled translation table, replacing any existing translations that
conflict with new translations.
</p></td></tr></tbody></table></div><p>
To compile a translation table, use
<a class="xref" href="#XtParseTranslationTable"><code class="function">XtParseTranslationTable</code></a>.
</p><div class="funcsynopsis"><a id="XtParseTranslationTable"></a><p><code class="funcdef">XtTranslations <strong class="fsfunc">XtParseTranslationTable</strong>(</code>String <var class="pdparam">table</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>table</em></span>
</span></p></td><td><p>
Specifies the translation table to compile.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtParseTranslationTable"><code class="function">XtParseTranslationTable</code></a>
function compiles the translation table, provided in the format given
in Appendix B, into an opaque internal representation
of type
<code class="function">XtTranslations</code>.
Note that if an empty translation table is required for any purpose,
one can be obtained by calling
<a class="xref" href="#XtParseTranslationTable"><code class="function">XtParseTranslationTable</code></a>
and passing an empty string.
</p><p>
To merge additional translations into an existing translation table, use
<a class="xref" href="#XtAugmentTranslations"><code class="function">XtAugmentTranslations</code></a>.
</p><div class="funcsynopsis"><a id="XtAugmentTranslations"></a><p><code class="funcdef">void <strong class="fsfunc">XtAugmentTranslations</strong>(</code>Widget <var class="pdparam">w</var>, XtTranslations <var class="pdparam">translations</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget into which the new translations are to be merged. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>translations</em></span>
</span></p></td><td><p>
Specifies the compiled translation table to merge in.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAugmentTranslations"><code class="function">XtAugmentTranslations</code></a>
function merges the new translations into the existing widget
translations, ignoring any
<code class="function">#replace</code>,
<code class="function">#augment</code>,
or
<code class="function">#override</code>
directive that may have been specified
in the translation string. The translation table specified by
<span class="emphasis"><em>translations</em></span> is not altered by this process.
<a class="xref" href="#XtAugmentTranslations"><code class="function">XtAugmentTranslations</code></a>
logically appends the string representation of the new translations to
the string representation of the widget's current translations and reparses
the result with no warning messages about duplicate left-hand sides, then
stores the result back into the widget instance; i.e.,
if the new translations contain an event or event sequence that
already exists in the widget's translations,
the new translation is ignored.
</p><p>
To overwrite existing translations with new translations, use
<a class="xref" href="#XtOverrideTranslations"><code class="function">XtOverrideTranslations</code></a>.
</p><div class="funcsynopsis"><a id="XtOverrideTranslations"></a><p><code class="funcdef">void <strong class="fsfunc">XtOverrideTranslations</strong>(</code>Widget <var class="pdparam">w</var>, XtTranslations <var class="pdparam">translations</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget into which the new translations are to be merged. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>translations</em></span>
</span></p></td><td><p>
Specifies the compiled translation table to merge in.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtOverrideTranslations"><code class="function">XtOverrideTranslations</code></a>
function merges the new translations into the existing widget
translations, ignoring any
<code class="function">#replace</code>,
<code class="function">#augment</code>,
or
<code class="function">#override</code>
directive that may have been
specified in the translation string. The translation table
specified by <span class="emphasis"><em>translations</em></span> is not altered by this process.
<a class="xref" href="#XtOverrideTranslations"><code class="function">XtOverrideTranslations</code></a>
logically appends the string representation of the widget's current
translations to the string representation of the new translations and
reparses the result with no warning messages about duplicate left-hand
sides, then stores the result back into the widget instance; i.e.,
if the new translations contain an event or event sequence that
already exists in the widget's translations,
the new translation overrides the widget's translation.
</p><p>
To replace a widget's translations completely, use
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
on the XtNtranslations resource and specify a compiled translation table
as the value.
</p><p>
To make it possible for users to easily modify translation tables in their
resource files,
the string-to-translation-table resource type converter
allows the string to specify whether the table should replace,
augment, or override any
existing translation table in the widget.
To specify this,
a pound sign (#) is given as the first character of the table
followed by one of the keywords ``replace'', ``augment'', or
``override'' to indicate
whether to replace, augment, or override the existing table.
The replace or merge
operation is performed during the
Core
instance initialization.
Each merge operation produces a new
translation resource value; if the original tables were shared by
other widgets, they are unaffected. If no directive is
specified, ``#replace'' is assumed.
</p><p>
At instance initialization
the XtNtranslations resource is first fetched. Then, if it was
not specified or did not contain ``#replace'', the
resource database is searched for the resource XtNbaseTranslations.
If XtNbaseTranslations is found, it is merged into the widget class
translation table. Then the widget <span class="emphasis"><em>translations</em></span> field is
merged into the result or into the class translation table if
XtNbaseTranslations was not found. This final table is then
stored into the widget <span class="emphasis"><em>translations</em></span> field. If the XtNtranslations
resource specified ``#replace'', no merge is done.
If neither XtNbaseTranslations or XtNtranslations are specified,
the class translation table is copied into the widget instance.
</p><p>
To completely remove existing translations, use
<a class="xref" href="#XtUninstallTranslations"><code class="function">XtUninstallTranslations</code></a>.
</p><div class="funcsynopsis"><a id="XtUninstallTranslations"></a><p><code class="funcdef">void <strong class="fsfunc">XtUninstallTranslations</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget from which the translations are to be removed. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtUninstallTranslations"><code class="function">XtUninstallTranslations</code></a>
function causes the entire translation table for the widget to be removed.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Using_Accelerators"></a>Using Accelerators</h2></div></div></div><p>
It is often desirable to be able to bind events in one widget to actions in
another.
In particular,
it is often useful to be able to invoke menu actions from the keyboard.
The Intrinsics provide a facility, called accelerators, that lets you
accomplish this.
An accelerator table is a translation table that is bound with its
actions in the context of a particular widget, the <span class="emphasis"><em>source</em></span> widget.
The accelerator table can then be installed on one or more <span class="emphasis"><em>destination</em></span> widgets.
When an event sequence in the destination widget would cause an
accelerator action to be taken, and if the source widget is sensitive,
the actions are executed as though triggered by the same event sequence
in the accelerator source
widget. The event is
passed to the action procedure without modification. The action
procedures used within accelerators must not assume that the source
widget is realized nor that any fields of the event are in reference
to the source widget's window if the widget is realized.
</p><p>
Each widget instance contains that widget's exported accelerator table
as a resource.
Each class of widget exports a method that takes a
displayable string representation of the accelerators
so that widgets can display their current accelerators.
The representation is the accelerator table in canonical
translation table form (see Appendix B).
The display_accelerator procedure pointer is of type
<a class="xref" href="#XtStringProc"><code class="function">(*XtStringProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtStringProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtStringProc)</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">string</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the source widget that supplied the accelerators.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>string</em></span>
</span></p></td><td><p>
Specifies the string representation of the accelerators for this widget.
</p></td></tr></tbody></table></div><p>
Accelerators can be specified in resource files,
and the string representation is the same as for a translation table.
However,
the interpretation of the
<code class="function">#augment</code>
and
<code class="function">#override</code>
directives applies to
what will happen when the accelerator is installed;
that is, whether or not the accelerator translations will override the
translations in the destination widget.
The default is
<code class="function">#augment</code>,
which means that the accelerator translations have lower priority
than the destination translations.
The
<code class="function">#replace</code>
directive is ignored for accelerator tables.
</p><p>
To parse an accelerator table, use
<a class="xref" href="#XtParseAcceleratorTable"><code class="function">XtParseAcceleratorTable</code></a>.
</p><div class="funcsynopsis"><a id="XtParseAcceleratorTable"></a><p><code class="funcdef">XtAccelerators <strong class="fsfunc">XtParseAcceleratorTable</strong>(</code>String <var class="pdparam">source</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>source</em></span>
</span></p></td><td><p>
Specifies the accelerator table to compile.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtParseAcceleratorTable"><code class="function">XtParseAcceleratorTable</code></a>
function compiles the accelerator table into an opaque internal representation.
The client
should set the XtNaccelerators resource of
each widget that is to be activated by these translations
to the returned value.
</p><p>
To install accelerators from a widget on another widget, use
<a class="xref" href="#XtInstallAccelerators"><code class="function">XtInstallAccelerators</code></a>.
</p><div class="funcsynopsis"><a id="XtInstallAccelerators"></a><p><code class="funcdef">void <strong class="fsfunc">XtInstallAccelerators</strong>(</code>Widget <var class="pdparam">destination</var>, Widget <var class="pdparam">source</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>destination</em></span>
</span></p></td><td><p>
Specifies the widget on which the accelerators are to be installed. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>source</em></span>
</span></p></td><td><p>
Specifies the widget from which the accelerators are to come. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtInstallAccelerators"><code class="function">XtInstallAccelerators</code></a>
function installs the <span class="emphasis"><em>accelerators</em></span> resource value from
<span class="emphasis"><em>source</em></span> onto <span class="emphasis"><em>destination</em></span>
by merging the source accelerators into the destination translations.
If the source <span class="emphasis"><em>display_accelerator</em></span> field is non-NULL,
<a class="xref" href="#XtInstallAccelerators"><code class="function">XtInstallAccelerators</code></a>
calls it with the source widget and a string representation
of the accelerator table,
which indicates that its accelerators have been installed
and that it should display them appropriately.
The string representation of the accelerator table is its
canonical translation table representation.
</p><p>
As a convenience for installing all accelerators from a widget and all its
descendants onto one destination, use
<a class="xref" href="#XtInstallAllAccelerators"><code class="function">XtInstallAllAccelerators</code></a>.
</p><div class="funcsynopsis"><a id="XtInstallAllAccelerators"></a><p><code class="funcdef">void <strong class="fsfunc">XtInstallAllAccelerators</strong>(</code>Widget <var class="pdparam">destination</var>, Widget <var class="pdparam">source</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>destination</em></span>
</span></p></td><td><p>
Specifies the widget on which the accelerators are to be installed. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>source</em></span>
</span></p></td><td><p>
Specifies the root widget of the widget tree
from which the accelerators are to come. Must be of class Core or any subclass thereof.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtInstallAllAccelerators"><code class="function">XtInstallAllAccelerators</code></a>
function recursively descends the widget tree rooted at <span class="emphasis"><em>source</em></span>
and installs the accelerators resource value
of each widget encountered onto <span class="emphasis"><em>destination</em></span>.
A common use is to call
<a class="xref" href="#XtInstallAllAccelerators"><code class="function">XtInstallAllAccelerators</code></a>
and pass the application main window as the source.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="KeyCode_to_KeySym_Conversions"></a>KeyCode-to-KeySym Conversions</h2></div></div></div><p>
The translation manager provides support for automatically translating
KeyCodes in incoming key events into KeySyms.
KeyCode-to-KeySym translator procedure pointers are of type
<a class="xref" href="#XtKeyProc"><code class="function">(*XtKeyProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtKeyProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtKeyProc)</strong>(</code>Display *<var class="pdparam">display</var>, KeyCode <var class="pdparam">keycode</var>, Modifiers <var class="pdparam">modifiers</var>, Modifiers *<var class="pdparam">modifiers_return</var>, KeySym *<var class="pdparam">keysym_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display that the KeyCode is from.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keycode</em></span>
</span></p></td><td><p>
Specifies the KeyCode to translate.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>modifiers</em></span>
</span></p></td><td><p>
Specifies the modifiers to the KeyCode.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>modifiers_return</em></span>
</span></p></td><td><p>
Specifies a location in which to store
a mask that indicates the subset of all
modifiers that are examined by the key translator for the specified keycode.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keysym_return</em></span>
</span></p></td><td><p>
Specifies a location in which to store the resulting KeySym.
</p></td></tr></tbody></table></div><p>
This procedure takes a KeyCode and modifiers and produces a KeySym.
For any given key translator function and keyboard encoding,
<span class="emphasis"><em>modifiers_return</em></span> will be a constant per KeyCode that indicates
the subset of all modifiers that are examined by the key translator
for that KeyCode.
</p><p>
The KeyCode-to-KeySym translator procedure
must be implemented such that multiple calls with the same
<span class="emphasis"><em>display</em></span>, <span class="emphasis"><em>keycode</em></span>, and <span class="emphasis"><em>modifiers</em></span> return the same
result until either a new case converter, an
<a class="xref" href="#XtCaseProc"><code class="function">(*XtCaseProc)</code></a>,
is installed or a
<code class="function">MappingNotify</code>
event is received.
</p><p>
The Intrinsics maintain tables internally to map KeyCodes to KeySyms
for each open display. Translator procedures and other clients may
share a single copy of this table to perform the same mapping.
</p><p>
To return a pointer to the KeySym-to-KeyCode mapping table for a
particular display, use
<a class="xref" href="#XtGetKeysymTable"><code class="function">XtGetKeysymTable</code></a>.
</p><div class="funcsynopsis"><a id="XtGetKeysymTable"></a><p><code class="funcdef">KeySym *<strong class="fsfunc">XtGetKeysymTable</strong>(</code>Display *<var class="pdparam">display</var>, KeyCode *<var class="pdparam">min_keycode_return</var>, int *<var class="pdparam">keysyms_per_keycode_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display whose table is required.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>min_keycode_return</em></span>
</span></p></td><td><p>
Returns the minimum KeyCode valid for the display.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keysyms_per_keycode_return</em></span>
</span></p></td><td><p>
Returns the number of KeySyms stored for each KeyCode.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGetKeysymTable"><code class="function">XtGetKeysymTable</code></a>
returns a pointer to the Intrinsics' copy of the
server's KeyCode-to-KeySym table. This table must not be modified.
There are <span class="emphasis"><em>keysyms_per_keycode_return</em></span> KeySyms associated with each
KeyCode, located in the table with indices starting at index
</p><div class="literallayout"><p><br />
(test_keycode - min_keycode_return) * keysyms_per_keycode_return<br />
</p></div><p>
for KeyCode <span class="emphasis"><em>test_keycode</em></span>. Any entries that have no KeySyms associated
with them contain the value
<code class="function">NoSymbol</code>.
Clients should not cache the KeySym table but should call
<a class="xref" href="#XtGetKeysymTable"><code class="function">XtGetKeysymTable</code></a>
each time the value is
needed, as the table may change prior to dispatching each event.
</p><p>
For more information on this table, see
<span class="olink">Section 12.7</span> in
<span class="olink">Xlib — C Language X Interface.</span>.
</p><p>
To register a key translator, use
<a class="xref" href="#XtSetKeyTranslator"><code class="function">XtSetKeyTranslator</code></a>.
</p><div class="funcsynopsis"><a id="XtSetKeyTranslator"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetKeyTranslator</strong>(</code>Display *<var class="pdparam">display</var>, XtKeyProc <var class="pdparam">proc</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display from which to translate the events.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to perform key translations.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtSetKeyTranslator"><code class="function">XtSetKeyTranslator</code></a>
function sets the specified procedure as the current key translator.
The default translator is
<code class="function">XtTranslateKey</code>,
an
<a class="xref" href="#XtKeyProc"><code class="function">(*XtKeyProc)</code></a>
that uses the Shift, Lock, numlock, and group modifiers
with the interpretations defined in <span class="emphasis"><em>X Window System Protocol</em></span>, Section 5.
It is provided so that new translators can call it to get default
KeyCode-to-KeySym translations and so that the default translator
can be reinstalled.
</p><p>
To invoke the currently registered KeyCode-to-KeySym translator,
use
<a class="xref" href="#XtTranslateKeycode"><code class="function">XtTranslateKeycode</code></a>.
</p><div class="funcsynopsis"><a id="XtTranslateKeycode"></a><p><code class="funcdef">void <strong class="fsfunc">XtTranslateKeycode</strong>(</code>Display *<var class="pdparam">display</var>, KeyCode <var class="pdparam">keycode</var>, Modifiers <var class="pdparam">modifiers</var>, Modifiers *<var class="pdparam">modifiers_return</var>, KeySym *<var class="pdparam">keysym_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display that the KeyCode is from.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keycode</em></span>
</span></p></td><td><p>
Specifies the KeyCode to translate.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>modifiers</em></span>
</span></p></td><td><p>
Specifies the modifiers to the KeyCode.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>modifiers_return</em></span>
</span></p></td><td><p>
Returns a mask that indicates the modifiers actually used
to generate the KeySym.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keysym_return</em></span>
</span></p></td><td><p>
Returns the resulting KeySym.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtTranslateKeycode"><code class="function">XtTranslateKeycode</code></a>
function passes the specified arguments
directly to the currently registered KeyCode-to-KeySym translator.
</p><p>
To handle capitalization of nonstandard KeySyms, the Intrinsics allow
clients to register case conversion routines.
Case converter procedure pointers are of type
<a class="xref" href="#XtCaseProc"><code class="function">(*XtCaseProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtCaseProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtCaseProc)</strong>(</code>Display *<var class="pdparam">display</var>, KeySym <var class="pdparam">keysym</var>, KeySym *<var class="pdparam">lower_return</var>, KeySym *<var class="pdparam">upper_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display connection for which the conversion is required.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keysym</em></span>
</span></p></td><td><p>
Specifies the KeySym to convert.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>lower_return</em></span>
</span></p></td><td><p>
Specifies a location into which to store the lowercase equivalent for
the KeySym.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>upper_return</em></span>
</span></p></td><td><p>
Specifies a location into which to store the uppercase equivalent for
the KeySym.
</p></td></tr></tbody></table></div><p>
If there is no case distinction,
this procedure should store the KeySym into both return values.
</p><p>
To register a case converter, use
<a class="xref" href="#XtRegisterCaseConverter"><code class="function">XtRegisterCaseConverter</code></a>.
</p><div class="funcsynopsis"><a id="XtRegisterCaseConverter"></a><p><code class="funcdef">void <strong class="fsfunc">XtRegisterCaseConverter</strong>(</code>Display *<var class="pdparam">display</var>, XtCaseProc <var class="pdparam">proc</var>, KeySym <var class="pdparam">start</var>, KeySym <var class="pdparam">stop</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display from which the key events are to come.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the
<a class="xref" href="#XtCaseProc"><code class="function">(*XtCaseProc)</code></a>
to do the conversions.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>start</em></span>
</span></p></td><td><p>
Specifies the first KeySym for which this converter is valid.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>stop</em></span>
</span></p></td><td><p>
Specifies the last KeySym for which this converter is valid.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRegisterCaseConverter"><code class="function">XtRegisterCaseConverter</code></a>
registers the specified case converter.
The <span class="emphasis"><em>start</em></span> and <span class="emphasis"><em>stop</em></span> arguments provide the inclusive range of KeySyms
for which this converter is to be called.
The new converter overrides any previous converters for KeySyms in that range.
No interface exists to remove converters;
you need to register an identity converter.
When a new converter is registered,
the Intrinsics refresh the keyboard state if necessary.
The default converter understands case conversion for all
Latin KeySyms defined in <span class="emphasis"><em>X Window System Protocol</em></span>, Appendix A.
</p><p>
To determine uppercase and lowercase equivalents for a KeySym, use
<a class="xref" href="#XtConvertCase"><code class="function">XtConvertCase</code></a>.
</p><div class="funcsynopsis"><a id="XtConvertCase"></a><p><code class="funcdef">void <strong class="fsfunc">XtConvertCase</strong>(</code>Display *<var class="pdparam">display</var>, KeySym <var class="pdparam">keysym</var>, KeySym *<var class="pdparam">lower_return</var>, KeySym *<var class="pdparam">upper_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display that the KeySym came from.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keysym</em></span>
</span></p></td><td><p>
Specifies the KeySym to convert.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>lower_return</em></span>
</span></p></td><td><p>
Returns the lowercase equivalent of the KeySym.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>upper_return</em></span>
</span></p></td><td><p>
Returns the uppercase equivalent of the KeySym.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtConvertCase"><code class="function">XtConvertCase</code></a>
function calls the appropriate converter and returns the results.
A user-supplied
<a class="xref" href="#XtKeyProc"><code class="function">(*XtKeyProc)</code></a>
may need to use this function.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Obtaining_a_KeySym_in_an_Action_Procedure"></a>Obtaining a KeySym in an Action Procedure</h2></div></div></div><p>
When an action procedure is invoked on a
<code class="function">KeyPress</code>
or
<code class="function">KeyRelease</code>
event, it often has a need to retrieve the KeySym and modifiers
corresponding to the event that caused it to be invoked. In order to
avoid repeating the processing that was just performed by the
Intrinsics to match the translation entry, the KeySym and modifiers
are stored for the duration of the action procedure and are made
available to the client.
</p><p>
To retrieve the KeySym and modifiers that matched the final event
specification in the translation table entry, use
<a class="xref" href="#XtGetActionKeysym"><code class="function">XtGetActionKeysym</code></a>.
</p><div class="funcsynopsis"><a id="XtGetActionKeysym"></a><p><code class="funcdef">KeySym <strong class="fsfunc">XtGetActionKeysym</strong>(</code>XEvent *<var class="pdparam">event</var>, Modifiers *<var class="pdparam">modifiers_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies the event pointer passed to the action procedure by the Intrinsics.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>modifiers_return</em></span>
</span></p></td><td><p>
Returns the modifiers that caused the match, if non-NULL.
</p></td></tr></tbody></table></div><p>
If
<a class="xref" href="#XtGetActionKeysym"><code class="function">XtGetActionKeysym</code></a>
is called after an action procedure has been
invoked by the Intrinsics and before that action procedure returns, and
if the event pointer has the same value as the event pointer passed to
that action routine, and if the event is a
<code class="function">KeyPress</code>
or
<code class="function">KeyRelease</code>
event, then
<a class="xref" href="#XtGetActionKeysym"><code class="function">XtGetActionKeysym</code></a>
returns the KeySym that matched the final
event specification in the translation table and, if <span class="emphasis"><em>modifiers_return</em></span>
is non-NULL, the modifier state actually used to generate this KeySym;
otherwise, if the event is a
<code class="function">KeyPress</code>
or
<code class="function">KeyRelease</code>
event, then
<a class="xref" href="#XtGetActionKeysym"><code class="function">XtGetActionKeysym</code></a>
calls
<a class="xref" href="#XtTranslateKeycode"><code class="function">XtTranslateKeycode</code></a>
and returns the results;
else it returns
<code class="function">NoSymbol</code>
and does not examine <span class="emphasis"><em>modifiers_return</em></span>.
</p><p>
Note that if an action procedure invoked by the Intrinsics
invokes a subsequent action procedure (and so on) via
<a class="xref" href="#XtCallActionProc"><code class="function">XtCallActionProc</code></a>,
the nested action procedure may also call
<a class="xref" href="#XtGetActionKeysym"><code class="function">XtGetActionKeysym</code></a>
to retrieve the Intrinsics' KeySym and modifiers.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="KeySym_to_KeyCode_Conversions"></a>KeySym-to-KeyCode Conversions</h2></div></div></div><p>
To return the list of KeyCodes that map to a particular KeySym in
the keyboard mapping table maintained by the Intrinsics, use
<a class="xref" href="#XtKeysymToKeycodeList"><code class="function">XtKeysymToKeycodeList</code></a>.
</p><div class="funcsynopsis"><a id="XtKeysymToKeycodeList"></a><p><code class="funcdef">void <strong class="fsfunc">XtKeysymToKeycodeList</strong>(</code>Display *<var class="pdparam">display</var>, KeySym <var class="pdparam">keysym</var>, KeyCode **<var class="pdparam">keycodes_return</var>, Cardinal *<var class="pdparam">keycount_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display whose table is required.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keysym</em></span>
</span></p></td><td><p>
Specifies the KeySym for which to search.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keycodes_return</em></span>
</span></p></td><td><p>
Returns a list of KeyCodes that have <span class="emphasis"><em>keysym</em></span>
associated with them, or NULL if <span class="emphasis"><em>keycount_return</em></span> is 0.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keycount_return</em></span>
</span></p></td><td><p>
Returns the number of KeyCodes in the keycode list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtKeysymToKeycodeList"><code class="function">XtKeysymToKeycodeList</code></a>
procedure returns all the KeyCodes that have <span class="emphasis"><em>keysym</em></span>
in their entry for the keyboard mapping table associated with <span class="emphasis"><em>display</em></span>.
For each entry in the
table, the first four KeySyms (groups 1 and 2) are interpreted as
specified by <span class="emphasis"><em>X Window System Protocol</em></span>, Section 5. If no KeyCodes map to the
specified KeySym, <span class="emphasis"><em>keycount_return</em></span> is zero and *<span class="emphasis"><em>keycodes_return</em></span> is NULL.
</p><p>
The caller should free the storage pointed to by <span class="emphasis"><em>keycodes_return</em></span> using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is no longer useful. If the caller needs to examine
the KeyCode-to-KeySym table for a particular KeyCode, it should call
<a class="xref" href="#XtGetKeysymTable"><code class="function">XtGetKeysymTable</code></a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Registering_Button_and_Key_Grabs_for_Actions"></a>Registering Button and Key Grabs for Actions</h2></div></div></div><p>
To register button and key grabs for a widget's window according to the
event bindings in the widget's translation table, use
<a class="xref" href="#XtRegisterGrabAction"><code class="function">XtRegisterGrabAction</code></a>.
</p><div class="funcsynopsis"><a id="XtRegisterGrabAction"></a><p><code class="funcdef">void <strong class="fsfunc">XtRegisterGrabAction</strong>(</code>XtActionProc <var class="pdparam">action_proc</var>, Boolean <var class="pdparam">owner_events</var>, unsigned int <var class="pdparam">event_mask</var>, int <var class="pdparam">pointer_mode</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>action_proc</em></span>
</span></p></td><td><p>
Specifies the action procedure to search for in translation tables.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>owner_events</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event_mask</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>pointer_mode</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>keyboard_mode</em></span>
</span></p></td><td><p>
Specify arguments to
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>
or
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtRegisterGrabAction"><code class="function">XtRegisterGrabAction</code></a>
adds the specified <span class="emphasis"><em>action_proc</em></span> to a list known to
the translation manager. When a widget is realized, or when the
translations of a realized widget or the accelerators installed on a
realized widget are modified, its translation table and any installed
accelerators are scanned for action procedures on this list.
If any are invoked on
<code class="function">ButtonPress</code>
or
<code class="function">KeyPress</code>
events as the only or final event
in a sequence, the Intrinsics will call
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>
or
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
for the widget with every button or KeyCode which maps to the
event detail field, passing the specified <span class="emphasis"><em>owner_events</em></span>, <span class="emphasis"><em>event_mask</em></span>,
<span class="emphasis"><em>pointer_mode</em></span>, and <span class="emphasis"><em>keyboard_mode</em></span>. For
<code class="function">ButtonPress</code>
events, the modifiers
specified in the grab are determined directly from the translation
specification and <span class="emphasis"><em>confine_to</em></span> and <span class="emphasis"><em>cursor</em></span> are specified as
<code class="function">None</code>.
For
<code class="function">KeyPress</code>
events, if the translation table entry specifies colon (:) in
the modifier list, the modifiers are determined by calling the key
translator procedure registered for the display and calling
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
for every combination of standard modifiers which map the KeyCode to
the specified event detail KeySym, and ORing any modifiers specified in
the translation table entry, and <span class="emphasis"><em>event_mask</em></span> is ignored. If the
translation table entry does not specify colon in the modifier list,
the modifiers specified in the grab are those specified in the
translation table entry only. For both
<code class="function">ButtonPress</code>
and
<code class="function">KeyPress</code>
events, don't-care modifiers are ignored unless the translation entry
explicitly specifies ``Any'' in the <span class="emphasis"><em>modifiers</em></span> field.
</p><p>
If the specified <span class="emphasis"><em>action_proc</em></span> is already registered for the calling
process, the new values will replace the previously specified values
for any widgets that become realized following the call, but existing
grabs are not altered on currently realized widgets.
</p><p>
When translations or installed accelerators are modified for a
realized widget, any previous key or button grabs registered
as a result of the old bindings are released if they do not appear in
the new bindings and are not explicitly grabbed by the client with
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>
or
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Invoking_Actions_Directly"></a>Invoking Actions Directly</h2></div></div></div><p>
Normally action procedures are invoked by the Intrinsics when an
event or event sequence arrives for a widget. To
invoke an action procedure directly, without generating
(or synthesizing) events, use
<a class="xref" href="#XtCallActionProc"><code class="function">XtCallActionProc</code></a>.
</p><div class="funcsynopsis"><a id="XtCallActionProc"></a><p><code class="funcdef">void <strong class="fsfunc">XtCallActionProc</strong>(</code>Widget <var class="pdparam">widget</var>, String <var class="pdparam">action</var>, XEvent *<var class="pdparam">event</var>, String *<var class="pdparam">params</var>, Cardinal <var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget in which the action is to be invoked. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>action</em></span>
</span></p></td><td><p>
Specifies the name of the action routine.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies the contents of the <span class="emphasis"><em>event</em></span> passed to the action routine.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies the contents of the <span class="emphasis"><em>params</em></span> passed to the action routine.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtCallActionProc"><code class="function">XtCallActionProc</code></a>
searches for the named action routine in the same
manner and order as translation tables are bound, as described in
Section 10.1.2, except that application action tables are searched, if
necessary, as of the time of the call to
<a class="xref" href="#XtCallActionProc"><code class="function">XtCallActionProc</code></a>.
If found,
the action routine is invoked with the specified widget, event pointer,
and parameters. It is the responsibility of the caller to ensure that
the contents of the <span class="emphasis"><em>event</em></span>, <span class="emphasis"><em>params</em></span>, and <span class="emphasis"><em>num_params</em></span> arguments are
appropriate for the specified action routine and, if necessary, that
the specified widget is realized or sensitive. If the named action
routine cannot be found,
<a class="xref" href="#XtCallActionProc"><code class="function">XtCallActionProc</code></a>
generates a warning message and returns.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Obtaining_a_Widget_s_Action_List"></a>Obtaining a Widget's Action List</h2></div></div></div><p>
Occasionally a subclass will require the pointers to one or more of
its superclass's action procedures. This would be needed, for
example, in order to envelop the superclass's action. To retrieve
the list of action procedures registered in the superclass's
<span class="emphasis"><em>actions</em></span> field, use
<a class="xref" href="#XtGetActionList"><code class="function">XtGetActionList</code></a>.
</p><div class="funcsynopsis"><a id="XtGetActionList"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetActionList</strong>(</code>WidgetClass <var class="pdparam">widget_class</var>, XtActionList *<var class="pdparam">actions_return</var>, Cardinal *<var class="pdparam">num_actions_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class whose actions are to be returned.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>actions_return</em></span>
</span></p></td><td><p>
Returns the action list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_actions_return</em></span>
</span></p></td><td><p>
Returns the number of action procedures declared by the class.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGetActionList"><code class="function">XtGetActionList</code></a>
returns the action table defined by the specified
widget class. This table does not include actions defined by the
superclasses. If <span class="emphasis"><em>widget_class</em></span> is not initialized, or is not
<code class="function">coreWidgetClass</code>
or a subclass thereof, or if the class does not define any actions,
*<span class="emphasis"><em>actions_return</em></span> will be NULL and *<span class="emphasis"><em>num_actions_return</em></span>
will be zero.
If *<span class="emphasis"><em>actions_return</em></span> is non-NULL the client is responsible for freeing
the table using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is no longer needed.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Utility_Functions"></a>Chapter 11. Utility Functions</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Determining_the_Number_of_Elements_in_an_Array">Determining the Number of Elements in an Array</a></span></dt><dt><span class="sect1"><a href="#Translating_Strings_to_Widget_Instances">Translating Strings to Widget Instances</a></span></dt><dt><span class="sect1"><a href="#Managing_Memory_Usage">Managing Memory Usage</a></span></dt><dt><span class="sect1"><a href="#Sharing_Graphics_Contexts">Sharing Graphics Contexts</a></span></dt><dt><span class="sect1"><a href="#Managing_Selections">Managing Selections</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Setting_and_Getting_the_Selection_Timeout_Value">Setting and Getting the Selection Timeout Value</a></span></dt><dt><span class="sect2"><a href="#Using_Atomic_Transfers">Using Atomic Transfers</a></span></dt><dt><span class="sect2"><a href="#Using_Incremental_Transfers">Using Incremental Transfers</a></span></dt><dt><span class="sect2"><a href="#Setting_and_Retrieving_Selection_Target_Parameters">Setting and Retrieving Selection Target Parameters</a></span></dt><dt><span class="sect2"><a href="#Generating_MULTIPLE_Requests">Generating MULTIPLE Requests</a></span></dt><dt><span class="sect2"><a href="#Auxiliary_Selection_Properties">Auxiliary Selection Properties</a></span></dt><dt><span class="sect2"><a href="#Retrieving_the_Most_Recent_Timestamp">Retrieving the Most Recent Timestamp</a></span></dt><dt><span class="sect2"><a href="#Retrieving_the_Most_Recent_Event">Retrieving the Most Recent Event</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Merging_Exposure_Events_into_a_Region">Merging Exposure Events into a Region</a></span></dt><dt><span class="sect1"><a href="#Translating_Widget_Coordinates">Translating Widget Coordinates</a></span></dt><dt><span class="sect1"><a href="#Translating_a_Window_to_a_Widget">Translating a Window to a Widget</a></span></dt><dt><span class="sect1"><a href="#Handling_Errors">Handling Errors</a></span></dt><dt><span class="sect1"><a href="#Setting_WM_COLORMAP_WINDOWS">Setting WM_COLORMAP_WINDOWS</a></span></dt><dt><span class="sect1"><a href="#Finding_File_Names">Finding File Names</a></span></dt><dt><span class="sect1"><a href="#Hooks_for_External_Agents">Hooks for External Agents</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Hook_Object_Resources">Hook Object Resources</a></span></dt><dt><span class="sect2"><a href="#Querying_Open_Displays">Querying Open Displays</a></span></dt></dl></dd></dl></div><p>
The Intrinsics provide a number of utility functions that you can use to
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Determine the number of elements in an array.
</p></li><li class="listitem"><p>
Translate strings to widget instances.
</p></li><li class="listitem"><p>
Manage memory usage.
</p></li><li class="listitem"><p>
Share graphics contexts.
</p></li><li class="listitem"><p>
Manipulate selections.
</p></li><li class="listitem"><p>
Merge exposure events into a region.
</p></li><li class="listitem"><p>
Translate widget coordinates.
</p></li><li class="listitem"><p>
Locate a widget given a window id.
</p></li><li class="listitem"><p>
Handle errors.
</p></li><li class="listitem"><p>
Set the WM_COLORMAP_WINDOWS property.
</p></li><li class="listitem"><p>
Locate files by name with string substitutions.
</p></li><li class="listitem"><p>
Register callback functions for external agents.
</p></li><li class="listitem"><p>
Locate all the displays of an application context.
</p></li></ul></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Determining_the_Number_of_Elements_in_an_Array"></a>Determining the Number of Elements in an Array</h2></div></div></div><p>
To determine the number of elements in a fixed-size array, use
<a class="xref" href="#XtNumber"><code class="function">XtNumber</code></a>.
</p><div class="funcsynopsis"><a id="XtNumber"></a><p><code class="funcdef">Cardinal <strong class="fsfunc">XtNumber</strong>(</code>ArrayType <var class="pdparam">array</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>array</em></span>
</span></p></td><td><p>
Specifies a fixed-size array of arbitrary type.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtNumber"><code class="function">XtNumber</code></a>
macro returns the number of elements allocated to the array.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Translating_Strings_to_Widget_Instances"></a>Translating Strings to Widget Instances</h2></div></div></div><p>
To translate a widget name to a widget instance, use
<a class="xref" href="#XtNameToWidget"><code class="function">XtNameToWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtNameToWidget"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtNameToWidget</strong>(</code>Widget <var class="pdparam">reference</var>, String <var class="pdparam">names</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>reference</em></span>
</span></p></td><td><p>
Specifies the widget from which the search is to start. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>names</em></span>
</span></p></td><td><p>
Specifies the partially qualified name of the desired widget.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtNameToWidget"><code class="function">XtNameToWidget</code></a>
function searches for a descendant of the <span class="emphasis"><em>reference</em></span>
widget whose name matches the specified names. The <span class="emphasis"><em>names</em></span> parameter
specifies a simple object name or a series of simple object name
components separated by periods or asterisks.
<a class="xref" href="#XtNameToWidget"><code class="function">XtNameToWidget</code></a>
returns the descendant with the shortest name matching the specification
according to the following rules, where child is either a pop-up child
or a normal child if the widget's class is a subclass of
Composite :
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Enumerate the object subtree rooted at the reference widget in
breadth-first order, qualifying the name of each object with the
names of all its ancestors up to, but not including, the reference
widget. The ordering between children of a common parent is
not defined.
</p></li><li class="listitem"><p>
Return the first object in the enumeration that matches the
specified name, where each component of <span class="emphasis"><em>names</em></span> matches exactly the
corresponding component of the qualified object name and asterisk
matches any series of components, including none.
</p></li><li class="listitem"><p>
If no match is found, return NULL.
</p></li></ul></div><p>
Since breadth-first traversal is specified, the descendant with the
shortest matching name (i.e., the fewest number of components), if any,
will always be returned. However, since the order of enumeration of
children is undefined and since the Intrinsics do not require that all
children of a widget have unique names,
<a class="xref" href="#XtNameToWidget"><code class="function">XtNameToWidget</code></a>
may return any
child that matches if there are multiple objects in the subtree with
the same name. Consecutive separators (periods or asterisks)
including at least one asterisk are treated as a single asterisk.
Consecutive periods are treated as a single period.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Managing_Memory_Usage"></a>Managing Memory Usage</h2></div></div></div><p>
The Intrinsics memory management functions provide uniform checking for
null pointers and error reporting on memory allocation errors.
These functions are completely compatible with their standard C language
runtime counterparts
<code class="function">malloc</code>,
<code class="function">calloc</code>,
<code class="function">realloc</code>,
and
<code class="function">free</code>
with the following added functionality:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>,
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>,
and
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>
give an error if there is not enough memory.
</p></li><li class="listitem"><p>
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
simply returns if passed a NULL pointer.
</p></li><li class="listitem"><p>
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>
simply allocates new storage if passed a NULL pointer.
</p></li></ul></div><p>
See the standard C library documentation on
<code class="function">malloc</code>,
<code class="function">calloc</code>,
<code class="function">realloc</code>,
and
<code class="function">free</code>
for more information.
</p><p>
To allocate storage, use
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>.
</p><div class="funcsynopsis"><a id="XtMalloc"></a><p><code class="funcdef">char * <strong class="fsfunc">XtMalloc</strong>(</code>Cardinal <var class="pdparam">size</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>size</em></span>
</span></p></td><td><p>
Specifies the number of bytes desired.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>
function returns a pointer to a block of storage of at least
the specified <span class="emphasis"><em>size</em></span> bytes.
If there is insufficient memory to allocate the new block,
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>
calls
<a class="xref" href="#XtErrorMsg"><code class="function">XtErrorMsg</code></a>.
</p><p>
To allocate and initialize an array, use
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>.
</p><div class="funcsynopsis"><a id="XtCalloc"></a><p><code class="funcdef">char * <strong class="fsfunc">XtCalloc</strong>(</code>Cardinal <var class="pdparam">num</var>, Cardinal <var class="pdparam">size</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>num</em></span>
</span></p></td><td><p>
Specifies the number of array elements to allocate.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>size</em></span>
</span></p></td><td><p>
Specifies the size of each array element in bytes.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>
function allocates space for the specified number of array elements
of the specified size and initializes the space to zero.
If there is insufficient memory to allocate the new block,
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>
calls
<a class="xref" href="#XtErrorMsg"><code class="function">XtErrorMsg</code></a>.
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>
returns the address of the allocated storage.
</p><p>
To change the size of an allocated block of storage, use
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>.
</p><div class="funcsynopsis"><a id="XtRealloc"></a><p><code class="funcdef">char *<strong class="fsfunc">XtRealloc</strong>(</code>char *<var class="pdparam">ptr</var>, Cardinal <var class="pdparam">num</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>ptr</em></span>
</span></p></td><td><p>
Specifies a pointer to the old storage allocated with
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>,
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>,
or
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>,
or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num</em></span>
</span></p></td><td><p>
Specifies number of bytes desired in new storage.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>
function changes the size of a block of storage, possibly moving it.
Then it copies the old contents (or as much as will fit) into the new block
and frees the old block.
If there is insufficient memory to allocate the new block,
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>
calls
<a class="xref" href="#XtErrorMsg"><code class="function">XtErrorMsg</code></a>.
If <span class="emphasis"><em>ptr</em></span> is NULL,
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>
simply calls
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>.
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>
then returns the address of the new block.
</p><p>
To free an allocated block of storage, use
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>.
</p><div class="funcsynopsis"><a id="XtFree"></a><p><code class="funcdef">void <strong class="fsfunc">XtFree</strong>(</code>char *<var class="pdparam">ptr</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>ptr</em></span>
</span></p></td><td><p>
Specifies a pointer to a block of storage allocated with
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>,
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>,
or
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>,
or NULL.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
function returns storage, allowing it to be reused.
If <span class="emphasis"><em>ptr</em></span> is NULL,
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
returns immediately.
</p><p>
To allocate storage for a new instance of a type, use
<a class="xref" href="#XtNew"><code class="function">XtNew</code></a>.
</p><div class="funcsynopsis"><a id="XtNew"></a><p><code class="funcdef">type <strong class="fsfunc">XtNew</strong>(</code>type <var class="pdparam">t</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies a previously declared type.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtNew"><code class="function">XtNew</code></a>
returns a pointer to the allocated storage.
If there is insufficient memory to allocate the new block,
<a class="xref" href="#XtNew"><code class="function">XtNew</code></a>
calls
<a class="xref" href="#XtErrorMsg"><code class="function">XtErrorMsg</code></a>.
<a class="xref" href="#XtNew"><code class="function">XtNew</code></a>
is a convenience macro that calls
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>
with the following arguments specified:
</p><div class="literallayout"><p><br />
((type *) XtMalloc((unsigned) sizeof(type)))<br />
</p></div><p>
The storage allocated by
<a class="xref" href="#XtNew"><code class="function">XtNew</code></a>
should be freed using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>.
</p><p>
To copy an instance of a string, use
<a class="xref" href="#XtNewString"><code class="function">XtNewString</code></a>.
</p><div class="funcsynopsis"><a id="XtNewString"></a><p><code class="funcdef">String <strong class="fsfunc">XtNewString</strong>(</code>String <var class="pdparam">string</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>string</em></span>
</span></p></td><td><p>
Specifies a previously declared string.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtNewString"><code class="function">XtNewString</code></a>
returns a pointer to the allocated storage.
If there is insufficient memory to allocate the new block,
<a class="xref" href="#XtNewString"><code class="function">XtNewString</code></a>
calls
<a class="xref" href="#XtErrorMsg"><code class="function">XtErrorMsg</code></a>.
<a class="xref" href="#XtNewString"><code class="function">XtNewString</code></a>
is a convenience macro that calls
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>
with the following arguments specified:
</p><div class="literallayout"><p><br />
(strcpy(XtMalloc((unsigned)strlen(str) + 1), str))<br />
</p></div><p>
The storage allocated by
<a class="xref" href="#XtNewString"><code class="function">XtNewString</code></a>
should be freed using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Sharing_Graphics_Contexts"></a>Sharing Graphics Contexts</h2></div></div></div><p>
The Intrinsics provide a mechanism whereby cooperating objects can share a
graphics context (GC), thereby reducing both the number of GCs
created and the total number of server calls in any given application.
The mechanism is a simple caching scheme
and allows for clients to declare both modifiable and nonmodifiable
fields of the shared GCs.
</p><p>
To obtain a shareable GC with modifiable fields, use
<a class="xref" href="#XtAllocateGC"><code class="function">XtAllocateGC</code></a>.
</p><div class="funcsynopsis"><a id="XtAllocateGC"></a><p><code class="funcdef">GC <strong class="fsfunc">XtAllocateGC</strong>(</code>Widget <var class="pdparam">object</var>, Cardinal <var class="pdparam">depth</var>, XtGCMask <var class="pdparam">value_mask</var>, XGCValues *<var class="pdparam">values</var>, XtGCMask <var class="pdparam">dynamic_mask</var>, XtGCMask <var class="pdparam">unused_mask</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies an object, giving the screen for which the
returned GC is valid. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>depth</em></span>
</span></p></td><td><p>
Specifies the depth for which the returned GC is valid, or 0.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value_mask</em></span>
</span></p></td><td><p>
Specifies fields of the GC that are initialized from <span class="emphasis"><em>values</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>values</em></span>
</span></p></td><td><p>
Specifies the values for the initialized fields.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>dynamic_mask</em></span>
</span></p></td><td><p>
Specifies fields of the GC that will be modified by the caller.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>unused_mask</em></span>
</span></p></td><td><p>
Specifies fields of the GC that will not be needed by the caller.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAllocateGC"><code class="function">XtAllocateGC</code></a>
function returns a shareable GC that may be
modified by the client. The <span class="emphasis"><em>screen</em></span> field of the specified
widget or of the nearest widget ancestor of the specified
object and the specified <span class="emphasis"><em>depth</em></span> argument supply
the root and drawable depths for which the GC is to be
valid. If <span class="emphasis"><em>depth</em></span> is zero, the depth is taken from the
<span class="emphasis"><em>depth</em></span> field of the specified widget or of the nearest
widget ancestor of the specified object.
</p><p>
The <span class="emphasis"><em>value_mask</em></span> argument specifies fields of the GC
that are initialized with the respective member of the
<span class="emphasis"><em>values</em></span> structure. The <span class="emphasis"><em>dynamic_mask</em></span> argument specifies fields
that the caller intends to modify during program execution.
The caller must ensure that the corresponding GC field is set
prior to each use of the GC. The <span class="emphasis"><em>unused_mask</em></span> argument
specifies fields of the GC that are of no interest to the
caller. The caller may make no assumptions about the contents
of any fields specified in <span class="emphasis"><em>unused_mask</em></span>. The caller may assume
that at all times all fields not specified in either
<span class="emphasis"><em>dynamic_mask</em></span> or <span class="emphasis"><em>unused_mask</em></span> have their default value if not
specified in <span class="emphasis"><em>value_mask</em></span> or the value specified by <span class="emphasis"><em>values</em></span>.
If a field is specified in both <span class="emphasis"><em>value_mask</em></span> and <span class="emphasis"><em>dynamic_mask</em></span>,
the effect is as if it were specified only in <span class="emphasis"><em>dynamic_mask</em></span>
and then immediately set to the value in <span class="emphasis"><em>values</em></span>. If a field
is set in <span class="emphasis"><em>unused_mask</em></span> and also in either <span class="emphasis"><em>value_mask</em></span> or
<span class="emphasis"><em>dynamic_mask</em></span>, the specification in <span class="emphasis"><em>unused_mask</em></span> is ignored.
</p><p>
<a class="xref" href="#XtAllocateGC"><code class="function">XtAllocateGC</code></a>
tries to minimize the number of unique GCs
created by comparing the arguments with those of previous
calls and returning an existing GC when there are no
conflicts.
<a class="xref" href="#XtAllocateGC"><code class="function">XtAllocateGC</code></a>
may modify and return an existing GC if it was allocated with a
nonzero <span class="emphasis"><em>unused_mask</em></span>.
</p><p>
To obtain a shareable GC with no modifiable fields, use
<a class="xref" href="#XtGetGC"><code class="function">XtGetGC</code></a>.
</p><div class="funcsynopsis"><a id="XtGetGC"></a><p><code class="funcdef">GC <strong class="fsfunc">XtGetGC</strong>(</code>Widget <var class="pdparam">object</var>, XtGCMask <var class="pdparam">value_mask</var>, XGCValues *<var class="pdparam">values</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies an object, giving the screen and depth for which the
returned GC is valid. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value_mask</em></span>
</span></p></td><td><p>
Specifies which fields of the <span class="emphasis"><em>values</em></span> structure are specified.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>values</em></span>
</span></p></td><td><p>
Specifies the actual values for this GC.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetGC"><code class="function">XtGetGC</code></a>
function returns a shareable, read-only GC.
The parameters to this function are the same as those for
<code class="function">XCreateGC</code>
except that an Object is passed instead of a Display.
<a class="xref" href="#XtGetGC"><code class="function">XtGetGC</code></a>
is equivalent to
<a class="xref" href="#XtAllocateGC"><code class="function">XtAllocateGC</code></a>
with <span class="emphasis"><em>depth</em></span>, <span class="emphasis"><em>dynamic_mask</em></span>, and <span class="emphasis"><em>unused_mask</em></span> all zero.
</p><p>
<a class="xref" href="#XtGetGC"><code class="function">XtGetGC</code></a>
shares only GCs in which all values in the GC returned by
<code class="function">XCreateGC</code>
are the same.
In particular, it does not use the <span class="emphasis"><em>value_mask</em></span> provided to
determine which fields of the GC a widget considers relevant.
The <span class="emphasis"><em>value_mask</em></span> is used only to tell the server which fields should be
filled in from <span class="emphasis"><em>values</em></span> and which it should fill in with default values.
</p><p>
To deallocate a shared GC when it is no longer needed, use
<a class="xref" href="#XtReleaseGC"><code class="function">XtReleaseGC</code></a>.
</p><div class="funcsynopsis"><a id="XtReleaseGC"></a><p><code class="funcdef">void <strong class="fsfunc">XtReleaseGC</strong>(</code>Widget <var class="pdparam">object</var>, GC <var class="pdparam">gc</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>object</em></span>
</span></p></td><td><p>
Specifies any object on the Display for which the GC was created. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>gc</em></span>
</span></p></td><td><p>
Specifies the shared GC obtained with either
<a class="xref" href="#XtAllocateGC"><code class="function">XtAllocateGC</code></a>
or
<a class="xref" href="#XtGetGC"><code class="function">XtGetGC</code></a>.
</p></td></tr></tbody></table></div><p>
References to shareable GCs are counted and a free request is generated to the
server when the last user of a given GC releases it.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Managing_Selections"></a>Managing Selections</h2></div></div></div><p>
Arbitrary widgets in multiple applications can communicate
with each other by means of the Intrinsics global selection mechanism,
which conforms to the specifications in the <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span>.
The Intrinsics supply functions for providing and receiving selection data in
one logical piece (atomic transfers)
or in smaller logical segments (incremental transfers).
</p><p>
The incremental interface is provided for a selection owner or
selection requestor that cannot or prefers not to pass the selection
value to and from the Intrinsics in a single call. For instance,
either an application that is running on a machine with limited memory
may not be able to store the entire selection value in memory or a
selection owner may already have the selection value available in
discrete chunks, and it would be more efficient not to have to
allocate additional storage to copy the pieces contiguously. Any
owner or requestor that prefers to deal with the selection value in
segments can use the incremental interfaces to do so.
The transfer between the selection owner or requestor and the Intrinsics is not
required to match the underlying
transport protocol between the application and the X server;
the Intrinsics will break too large a selection
into smaller pieces for transport if necessary
and will coalesce a selection transmitted incrementally if the value
was requested atomically.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Setting_and_Getting_the_Selection_Timeout_Value"></a>Setting and Getting the Selection Timeout Value</h3></div></div></div><p>
To set the Intrinsics selection timeout, use
<a class="xref" href="#XtAppSetSelectionTimeout"><code class="function">XtAppSetSelectionTimeout</code></a>.
</p><div class="funcsynopsis"><a id="XtAppSetSelectionTimeout"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppSetSelectionTimeout</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, unsigned long <var class="pdparam">timeout</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>timeout</em></span>
</span></p></td><td><p>
Specifies the selection timeout in milliseconds.
</p></td></tr></tbody></table></div><p>
To get the current selection timeout value, use
<a class="xref" href="#XtAppGetSelectionTimeout"><code class="function">XtAppGetSelectionTimeout</code></a>.
</p><div class="funcsynopsis"><a id="XtAppGetSelectionTimeout"></a><p><code class="funcdef">unsigned long <strong class="fsfunc">XtAppGetSelectionTimeout</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppGetSelectionTimeout"><code class="function">XtAppGetSelectionTimeout</code></a>
function returns the current selection timeout value in milliseconds.
The selection timeout is the time within which the two communicating
applications must respond to one another.
The initial timeout value is set by the
selectionTimeout
application resource as retrieved by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>.
If
selectionTimeout
is not specified,
the default is five seconds.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Using_Atomic_Transfers"></a>Using Atomic Transfers</h3></div></div></div><p>
When using atomic transfers, the owner will completely
process one selection request at a time.
The owner may consider each request individually,
since there is no possibility for overlap
between evaluation of two requests.
</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Atomic_Transfer_Procedures"></a>Atomic Transfer Procedures</h4></div></div></div><p>
The following procedures are used by the selection owner when
providing selection data in a single unit.
</p><p>
The procedure pointer specified by the owner to supply the selection
data to the Intrinsics is of type
<a class="xref" href="#XtConvertSelectionProc"><code class="function">(*XtConvertSelectionProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtConvertSelectionProc"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtConvertSelectionProc)</strong>(</code>Widget <var class="pdparam">w</var>, Atom *<var class="pdparam">selection</var>, Atom *<var class="pdparam">target</var>, Atom *<var class="pdparam">type_return</var>, XtPointer *<var class="pdparam">value_return</var>, unsigned long *<var class="pdparam">length_return</var>, int *<var class="pdparam">format_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that currently owns this selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom naming the selection requested
(for example,
<code class="function">XA_PRIMARY</code>
or
<code class="function">XA_SECONDARY ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>target</em></span>
</span></p></td><td><p>
Specifies the target type of the selection that has been requested,
which indicates the desired information about the selection
(for example, File Name, Text, Window).
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type_return</em></span>
</span></p></td><td><p>
Specifies a pointer to an atom into which the property type of the
converted value of the selection is to be stored.
For instance, either File Name or Text might have property type
<code class="function">XA_STRING</code>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which a pointer to the converted value of the
selection is to be stored.
The selection owner is responsible for allocating this storage.
If the selection owner has provided an
<a class="xref" href="#XtSelectionDoneProc"><code class="function">(*XtSelectionDoneProc)</code></a>
for the selection,
this storage is owned by the selection owner;
otherwise, it is owned by the Intrinsics selection mechanism,
which frees it by calling
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is done with it.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>length_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which the number of elements in <span class="emphasis"><em>value_return</em></span>,
each of size indicated by <span class="emphasis"><em>format_return</em></span>, is to be stored.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>format_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which the size in bits of the data elements
of the selection value is to be stored.
</p></td></tr></tbody></table></div><p>
This procedure is called by the Intrinsics selection mechanism
to get the value of a selection as a given type
from the current selection owner.
It returns
<code class="function">True</code>
if the owner successfully converted the selection to the target type or
<code class="function">False</code>
otherwise.
If the procedure returns
<code class="function">False</code>,
the values of the return arguments are undefined.
Each
<a class="xref" href="#XtConvertSelectionProc"><code class="function">(*XtConvertSelectionProc)</code></a>
should respond to target value
<code class="function">TARGETS</code>
by returning a value containing the list of the targets
into which it is
prepared to convert the selection.
The value returned in
<span class="emphasis"><em>format_return</em></span> must be one of 8, 16, or 32 to allow the server to
byte-swap the data if necessary.
</p><p>
This procedure does not need to worry about responding to the
MULTIPLE or the TIMESTAMP target values (see
<a class="xref" href="#Window_Creation_Convenience_Routine" title="Window Creation Convenience Routine">the section called “Window Creation Convenience Routine”</a>
in the <span class="olink">Inter-Client Communication Conventions Manual.</span>).
A selection request with
the MULTIPLE target type is transparently transformed into a
series of calls to this procedure, one for each target type, and a
selection request with the TIMESTAMP target value is answered
automatically by the Intrinsics using the time specified in the
call to
<a class="xref" href="#XtOwnSelection"><code class="function">XtOwnSelection</code></a>
or
<a class="xref" href="#XtOwnSelectionIncremental"><code class="function">XtOwnSelectionIncremental</code></a>.
</p><p>
To retrieve the
<code class="function">SelectionRequest</code>
event that triggered the
<a class="xref" href="#XtConvertSelectionProc"><code class="function">(*XtConvertSelectionProc)</code></a>
procedure, use
<a class="xref" href="#XtGetSelectionRequest"><code class="function">XtGetSelectionRequest</code></a>.
</p><div class="funcsynopsis"><a id="XtGetSelectionRequest"></a><p><code class="funcdef">XSelectionRequestEvent *<strong class="fsfunc">XtGetSelectionRequest</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, XtRequestId <var class="pdparam">request_id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that currently owns this selection. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the selection being processed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request_id</em></span>
</span></p></td><td><p>
Specifies the requestor id in the case of incremental
selections, or NULL in the case of atomic transfers.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGetSelectionRequest"><code class="function">XtGetSelectionRequest</code></a>
may be called only from within an
<a class="xref" href="#XtConvertSelectionProc"><code class="function">(*XtConvertSelectionProc)</code></a>
procedure and returns a pointer to the
<code class="function">SelectionRequest</code>
event that caused the conversion procedure to be invoked.
<span class="emphasis"><em>Request_id</em></span> specifies a unique id for the individual request in the
case that multiple incremental transfers are outstanding. For atomic
transfers, <span class="emphasis"><em>request_id</em></span> must be specified as NULL. If no
<code class="function">SelectionRequest</code>
event is being processed for the specified
<span class="emphasis"><em>widget</em></span>, <span class="emphasis"><em>selection</em></span>, and <span class="emphasis"><em>request_id</em></span>,
<a class="xref" href="#XtGetSelectionRequest"><code class="function">XtGetSelectionRequest</code></a>
returns NULL.
</p><p>
The procedure pointer specified by the owner when it desires
notification upon losing ownership is of type
<a class="xref" href="#XtLoseSelectionProc"><code class="function">(*XtLoseSelectionProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtLoseSelectionProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtLoseSelectionProc)</strong>(</code>Widget <var class="pdparam">w</var>, Atom *<var class="pdparam">selection</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that has lost selection ownership.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom naming the selection.
</p></td></tr></tbody></table></div><p>
This procedure is called by the Intrinsics selection mechanism
to inform the specified widget that it has lost the given selection.
Note that this procedure does not ask the widget to relinquish the
selection ownership; it is merely informative.
</p><p>
The procedure pointer specified by the owner when it desires
notification of receipt of the data or when it manages the storage
containing the data is of type
<a class="xref" href="#XtSelectionDoneProc"><code class="function">(*XtSelectionDoneProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtSelectionDoneProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtSelectionDoneProc)</strong>(</code>Widget <var class="pdparam">w</var>, Atom *<var class="pdparam">selection</var>, Atom *<var class="pdparam">target</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that owns the converted selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom naming the selection that was converted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>target</em></span>
</span></p></td><td><p>
Specifies the target type to which the conversion was done.
</p></td></tr></tbody></table></div><p>
This procedure is called by the Intrinsics selection mechanism
to inform the selection owner that a selection requestor has successfully
retrieved a selection value.
If the selection owner has registered an
<a class="xref" href="#XtSelectionDoneProc"><code class="function">(*XtSelectionDoneProc)</code></a>,
it should expect it to be called once for each conversion that it performs,
after the converted value has been successfully transferred
to the requestor.
If the selection owner has registered an
<a class="xref" href="#XtSelectionDoneProc"><code class="function">(*XtSelectionDoneProc)</code></a>,
it also owns the storage containing the converted
selection value.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Getting_the_Selection_Value"></a>Getting the Selection Value</h4></div></div></div><p>
The procedure pointer specified by the requestor to receive the
selection data from the Intrinsics is of type
<a class="xref" href="#XtSelectionCallbackProc"><code class="function">(*XtSelectionCallbackPro)</code></a>.
</p><div class="funcsynopsis"><a id="XtSelectionCallbackProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtSelectionCallbackPro)</strong>(</code>Widget <var class="pdparam">w</var>, XtPointer <var class="pdparam">client_data</var>, Atom *<var class="pdparam">selection</var>, Atom *<var class="pdparam">type</var>, XtPointer <var class="pdparam">value</var>, unsigned long *<var class="pdparam">length</var>, int *<var class="pdparam">format</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that requested the selection value.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies a value passed in by the widget when it requested the
selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the name of the selection that was requested.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the representation type of the selection value (for example,
<code class="function">XA_STRING ).</code>
Note that it is not the target that was requested (which the client
must remember for itself), but the type that
is used to represent the target.
The special symbolic constant
<code class="function">XT_CONVERT_FAIL</code>
is used to indicate that the selection conversion failed because the
selection owner did not respond within the Intrinsics selection timeout
interval.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value</em></span>
</span></p></td><td><p>
Specifies a pointer to the selection value.
The requesting client owns this storage and is responsible for freeing it
by calling
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is done with it.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>length</em></span>
</span></p></td><td><p>
Specifies the number of elements in <span class="emphasis"><em>value</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>format</em></span>
</span></p></td><td><p>
Specifies the size in bits of the data in each element of <span class="emphasis"><em>value</em></span>.
</p></td></tr></tbody></table></div><p>
This procedure is called by the Intrinsics selection mechanism to deliver the
requested selection to the requestor.
</p><p>
If the
<code class="function">SelectionNotify</code>
event returns a property of
<code class="function">None</code>,
meaning the conversion has been refused because there is no owner for the
specified selection or the owner cannot convert the selection to the
requested target for any reason, the procedure is called with a value
of NULL and a length of zero.
</p><p>
To obtain the selection value in a single logical unit, use
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
or
<a class="xref" href="#XtGetSelectionValues"><code class="function">XtGetSelectionValues</code></a>.
</p><div class="funcsynopsis"><a id="XtGetSelectionValue"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetSelectionValue</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, Atom <var class="pdparam">target</var>, XtSelectionCallbackProc <var class="pdparam">callback</var>, XtPointer <var class="pdparam">client_data</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the particular selection desired; for example,
<code class="function">XA_PRIMARY</code>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>target</em></span>
</span></p></td><td><p>
Specifies the type of information needed about the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback</em></span>
</span></p></td><td><p>
Specifies the procedure to be called when the selection value
has been obtained.
Note that this is how the selection value is communicated back to the client.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies additional data to be passed to the specified procedure
when it is called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the selection request was
initiated.
This should be the timestamp of the event that triggered this request;
the value
<code class="function">CurrentTime</code>
is not acceptable.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
function requests the value of the selection converted to
the target type.
The specified callback is called at some time after
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
is called, when the selection value is received from the X server.
It may be called before or after
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
returns.
For more information about <span class="emphasis"><em>selection</em></span>,
<span class="emphasis"><em>target</em></span>, and
<span class="emphasis"><em>time</em></span>, see
<span class="olink">Section 2.6</span> in the
<span class="olink">Inter-Client Communication Conventions Manual.</span>.
</p><div class="funcsynopsis"><a id="XtGetSelectionValues"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetSelectionValues</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, Atom *<var class="pdparam">targets</var>, int <var class="pdparam">count</var>, XtSelectionCallbackProc <var class="pdparam">callback</var>, XtPointer *<var class="pdparam">client_data</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the particular selection desired (that is, primary or secondary).
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>targets</em></span>
</span></p></td><td><p>
Specifies the types of information needed about the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>count</em></span>
</span></p></td><td><p>
Specifies the length of the <span class="emphasis"><em>targets</em></span> and <span class="emphasis"><em>client_data</em></span> lists.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>callback</em></span>
</span></p></td><td><p>
Specifies the callback procedure
to be called with each selection value obtained.
Note that this is how the selection values are communicated back to the
client.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies a list of additional data values, one for each target type,
that are passed to the callback procedure when it is called for that target.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the selection request was
initiated.
This should be the timestamp of the event that triggered this request;
the value
<code class="function">CurrentTime</code>
is not acceptable.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetSelectionValues"><code class="function">XtGetSelectionValues</code></a>
function is similar to multiple calls to
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
except that it guarantees that no other client can assert ownership
between requests and therefore that all the conversions will refer to
the same selection value. The callback is invoked once for each
target value with the corresponding client data.
For more information about <span class="emphasis"><em>selection</em></span>, <span class="emphasis"><em>target</em></span>, and
<span class="emphasis"><em>time</em></span>, see
<span class="olink">section 2.6</span>
in the <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span>.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Setting_the_Selection_Owner"></a>Setting the Selection Owner</h4></div></div></div><p>
To set the selection owner and indicate that the selection value will
be provided in one piece, use
<a class="xref" href="#XtOwnSelection"><code class="function">XtOwnSelection</code></a>.
</p><div class="funcsynopsis"><a id="XtOwnSelection"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtOwnSelection</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, Time <var class="pdparam">time</var>, XtConvertSelectionProc <var class="pdparam">convert_proc</var>, XtLoseSelectionProc <var class="pdparam">lose_selection</var>, XtSelectionDoneProc <var class="pdparam">done_proc</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that wishes to become the owner. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the name of the selection (for example,
<code class="function">XA_PRIMARY ).</code>
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the ownership request was
initiated.
This should be the timestamp of the event that triggered ownership;
the value
<code class="function">CurrentTime</code>
is not acceptable.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>convert_proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called whenever a client requests the
current value of the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>lose_selection</em></span>
</span></p></td><td><p>
Specifies the procedure to be called whenever the widget has
lost selection ownership, or NULL if the owner is not interested in being
called back.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>done_proc</em></span>
</span></p></td><td><p>
Specifies the procedure called
after the requestor has received the selection value, or NULL if the
owner is not
interested in being called back.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtOwnSelection"><code class="function">XtOwnSelection</code></a>
function informs the Intrinsics selection mechanism that a
widget wishes to own a selection.
It returns
<code class="function">True</code>
if the widget successfully becomes the owner and
<code class="function">False</code>
otherwise.
The widget may fail to become the owner if some other widget
has asserted ownership at a time later than this widget.
The widget can lose selection ownership either
because some other widget asserted later ownership of the selection
or because the widget voluntarily gave up ownership of the selection.
The lose_selection procedure is not called
if the widget fails to obtain selection ownership in the first place.
</p><p>
If a done_proc is specified, the client owns the storage allocated
for passing the value to the Intrinsics. If <span class="emphasis"><em>done_proc</em></span> is NULL,
the convert_proc must allocate storage using
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>,
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>,
or
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>,
and the value specified is freed by the
Intrinsics when the transfer is complete.
</p><p>
Usually, a selection owner maintains ownership indefinitely until some
other widget requests ownership, at which time
the Intrinsics selection mechanism informs the previous owner that it
has lost ownership of the selection.
However, in response to some user actions
(for example, when a user deletes the information selected),
the application may wish to explicitly inform the Intrinsics
by using
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>
that it no longer is to be the selection owner.
</p><div class="funcsynopsis"><a id="XtDisownSelection"></a><p><code class="funcdef">void <strong class="fsfunc">XtDisownSelection</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that wishes to relinquish ownership.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom naming the selection being given up.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the request to
relinquish selection ownership was initiated.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>
function informs the Intrinsics selection mechanism that
the specified widget is to lose ownership of the selection.
If the widget does not currently own the selection, either
because it lost the selection
or because it never had the selection to begin with,
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>
does nothing.
</p><p>
After a widget has called
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>,
its convert procedure is not called even if a request arrives later
with a timestamp during the period that this widget owned the selection.
However, its done procedure is called if a conversion that started
before the call to
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>
finishes after the call to
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Using_Incremental_Transfers"></a>Using Incremental Transfers</h3></div></div></div><p>
When using the incremental interface, an owner may have to process
more than one selection request for the same selection, converted to
the same target, at the same time. The incremental functions take a
<span class="emphasis"><em>request_id</em></span> argument, which is an identifier that is guaranteed to be
unique among all incremental requests that are active concurrently.
</p><p>
For example, consider the following:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Upon receiving a request for the selection value, the owner sends
the first segment.
</p></li><li class="listitem"><p>
While waiting to be called to provide the next segment value but
before sending it, the owner receives another request from a
different requestor for the same selection value.
</p></li><li class="listitem"><p>
To distinguish between the requests, the owner uses the request_id
value. This allows the owner to distinguish between the first
requestor, which is asking for the second segment, and the second
requestor, which is asking for the first segment.
</p></li></ul></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Incremental_Transfer_Procedures"></a>Incremental Transfer Procedures</h4></div></div></div><p>
The following procedures are used by selection owners who wish to
provide the selection data in multiple segments.
</p><p>
The procedure pointer specified by the incremental owner to supply the
selection data to the Intrinsics is of type
<a class="xref" href="#XtConvertSelectionIncrProc"><code class="function">(*XtConvertSelectionIncrProc)</code></a>.
</p><div class="literallayout"><p><br />
typedef XtPointer XtRequestId;<br />
</p></div><div class="funcsynopsis"><a id="XtConvertSelectionIncrProc"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtConvertSelectionIncrProc)</strong>(</code>Widget <var class="pdparam">w</var>, Atom *<var class="pdparam">selection</var>, Atom *<var class="pdparam">target</var>, Atom *<var class="pdparam">type_return</var>, XtPointer *<var class="pdparam">value_return</var>, unsigned long *<var class="pdparam">length_return</var>, int *<var class="pdparam">format_return</var>, unsigned long *<var class="pdparam">max_length</var>, XtPointer <var class="pdparam">client_data</var>, XtRequestId *<var class="pdparam">request_id</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that currently owns this selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom that names the selection requested.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>target</em></span>
</span></p></td><td><p>
Specifies the type of information required about the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type_return</em></span>
</span></p></td><td><p>
Specifies a pointer to an atom into which the property
type of the converted value of the selection is to be
stored.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which a pointer to the
converted value of the selection is to be stored.
The selection owner is responsible for allocating this storage.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>length_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which the number of elements
in <span class="emphasis"><em>value_return</em></span>, each of size indicated by
<span class="emphasis"><em>format_return</em></span>, is to be stored.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>format_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which the size in bits of the
data elements of the selection value is to be stored so that the
server may byte-swap the data if necessary.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>max_length</em></span>
</span></p></td><td><p>
Specifies the maximum number of bytes which may be
transferred at any one time.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the value passed in by the widget when it
took ownership of the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request_id</em></span>
</span></p></td><td><p>
Specifies an opaque identification for a specific request.
</p></td></tr></tbody></table></div><p>
This procedure is called repeatedly by the Intrinsics selection mechanism to get
the next incremental chunk of data from a selection owner who has
called
<a class="xref" href="#XtOwnSelectionIncremental"><code class="function">XtOwnSelectionIncremental</code></a>.
It must return
<code class="function">True</code>
if the procedure has succeeded in converting the selection data or
<code class="function">False</code>
otherwise.
On the first call with a particular request id, the owner must begin
a new incremental transfer for the requested selection and target. On
subsequent calls with the same request id, the owner may assume that
the previously supplied value is no longer needed by the Intrinsics;
that is, a fixed transfer area may be allocated and returned in <span class="emphasis"><em>value_return</em></span>
for each segment to be transferred. This procedure should store a
non-NULL value in <span class="emphasis"><em>value_return</em></span> and zero in <span class="emphasis"><em>length_return</em></span> to indicate that the
entire selection has been delivered. After returning this final
segment, the request id may be reused by the Intrinsics to begin a
new transfer.
</p><p>
To retrieve the
<code class="function">SelectionRequest</code>
event that triggered the selection conversion procedure, use
<a class="xref" href="#XtGetSelectionRequest"><code class="function">XtGetSelectionRequest</code></a>,
described in Section 11.5.2.1.
</p><p>
The procedure pointer specified by the incremental selection owner
when it desires notification upon no longer having ownership is of
type
<a class="xref" href="#XtLoseSelectionIncrProc"><code class="function">(*XtLoseSelectionIncrProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtLoseSelectionIncrProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtLoseSelectionIncrProc)</strong>(</code>Widget <var class="pdparam">w</var>, Atom *<var class="pdparam">selection</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that has lost the selection ownership.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom that names the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the value passed in by the widget when it
took ownership of the selection.
</p></td></tr></tbody></table></div><p>
This procedure, which is optional, is called by the Intrinsics to
inform the selection owner that it no longer owns the selection.
</p><p>
The procedure pointer specified by the incremental selection owner
when it desires notification of receipt of the data or when it manages
the storage containing the data is of type
<a class="xref" href="#XtSelectionDoneIncrProc"><code class="function">(*XtSelectionDoneIncrProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtSelectionDoneIncrProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtSelectionDoneIncrProc)</strong>(</code>Widget <var class="pdparam">w</var>, Atom *<var class="pdparam">selection</var>, Atom *<var class="pdparam">target</var>, XtRequestId *<var class="pdparam">request_id</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that owns the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom that names the selection being transferred.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>target</em></span>
</span></p></td><td><p>
Specifies the target type to which the conversion was done.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request_id</em></span>
</span></p></td><td><p>
Specifies an opaque identification for a specific request.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specified the value passed in by the widget when it
took ownership of the selection.
</p></td></tr></tbody></table></div><p>
This procedure, which is optional, is called by the Intrinsics after
the requestor has retrieved the final (zero-length) segment of the
incremental transfer to indicate that the entire transfer is complete.
If this procedure is not specified, the Intrinsics will free only the
final value returned by the selection owner using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>.
</p><p>
The procedure pointer specified by the incremental selection owner to
notify it if a transfer should be terminated prematurely is of type
<a class="xref" href="#XtCancelConvertSelectionProc"><code class="function">(*XtCancelConvertSelectionProc)</code></a>.
</p><div class="funcsynopsis"><a id="XtCancelConvertSelectionProc"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtCancelConvertSelectionProc)</strong>(</code>Widget <var class="pdparam">w</var>, Atom *<var class="pdparam">selection</var>, Atom *<var class="pdparam">target</var>, XtRequestId *<var class="pdparam">request_id</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that owns the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom that names the selection being transferred.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>target</em></span>
</span></p></td><td><p>
Specifies the target type to which the conversion was done.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request_id</em></span>
</span></p></td><td><p>
Specifies an opaque identification for a specific request.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the value passed in by the widget when it took ownership of
the selection.
</p></td></tr></tbody></table></div><p>
This procedure is called by the Intrinsics when it has been determined
by means of a timeout or other mechanism that any remaining segments
of the selection no longer need to be transferred. Upon receiving
this callback, the selection request is considered complete and the
owner can free the memory and any other resources that have been
allocated for the transfer.
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Getting_the_Selection_Value_Incrementally"></a>Getting the Selection Value Incrementally</h4></div></div></div><p>
To obtain the value of the selection using incremental transfers, use
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
or
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>.
</p><div class="funcsynopsis"><a id="XtGetSelectionValueIncremental"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetSelectionValueIncremental</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, Atom <var class="pdparam">target</var>, XtSelectionCallbackProc <var class="pdparam">selection_callback</var>, XtPointer <var class="pdparam">client_data</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the particular selection desired.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>target</em></span>
</span></p></td><td><p>
Specifies the type of information needed
about the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection_callback</em></span>
</span></p></td><td><p>
Specifies the callback procedure to be
called to receive each data segment.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies client-specific data to be passed to
the specified callback procedure when it is invoked.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the
selection request was initiated. This should be the
timestamp of the event that triggered this request;
the value
<code class="function">CurrentTime</code>
is not acceptable.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
function is similar to
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
except that the selection_callback procedure will
be called repeatedly upon delivery of multiple segments of the
selection value. The end of the selection value is indicated when
<span class="emphasis"><em>selection_callback</em></span> is called with a non-NULL value of length zero,
which must still be freed by the client. If the
transfer of the selection is aborted in the middle of a transfer
(for example, because of a timeout), the selection_callback procedure is
called with a type value equal to the symbolic constant
<code class="function">XT_CONVERT_FAIL</code>
so that the requestor can dispose
of the partial selection value it has collected up until that point.
Upon receiving
<code class="function">XT_CONVERT_FAIL</code>,
the requesting client must determine
for itself whether or not a partially completed data transfer is meaningful.
For more information about <span class="emphasis"><em>selection</em></span>,
<span class="emphasis"><em>target</em></span>, and
<span class="emphasis"><em>time</em></span>, see
<span class="olink">????</span> in the
<span class="olink">Inter-Client Communication Conventions Manual.</span>
</p><div class="funcsynopsis"><a id="XtGetSelectionValuesIncremental"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetSelectionValuesIncremental</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, Atom *<var class="pdparam">targets</var>, int <var class="pdparam">count</var>, XtSelectionCallbackProc <var class="pdparam">selection_callback</var>, XtPointer *<var class="pdparam">client_data</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the particular selection desired.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>targets</em></span>
</span></p></td><td><p>
Specifies the types of information needed about
the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>count</em></span>
</span></p></td><td><p>
Specifies the length of the <span class="emphasis"><em>targets</em></span> and <span class="emphasis"><em>client_data</em></span> lists.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection_callback</em></span>
</span></p></td><td><p>
Specifies the callback procedure to be called
to receive each selection value.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies a list of client data (one for each target
type) values that are passed to the callback procedure when
it is invoked for the corresponding target.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the
selection request was initiated. This should be the
timestamp of the event that triggered this request;
the value
<code class="function">CurrentTime</code>
is not acceptable.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>
function is similar to
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
except that it takes a list of targets and client data.
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>
is equivalent to calling
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
successively for each <span class="emphasis"><em>target/client_data</em></span> pair except that
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>
does guarantee that all the conversions will use the same selection
value because the ownership of the selection cannot change in the
middle of the list, as would be possible when calling
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
repeatedly.
For more information about <span class="emphasis"><em>selection</em></span>, <span class="emphasis"><em>target</em></span>, and
<span class="emphasis"><em>time</em></span>, see
<span class="olink">Section 2.6</span> in the
<span class="olink">Inter-Client Communication Conventions Manual.</span>
</p></div><div class="sect3"><div class="titlepage"><div><div><h4 class="title"><a id="Setting_the_Selection_Owner_for_Incremental_Transfers"></a>Setting the Selection Owner for Incremental Transfers</h4></div></div></div><p>
To set the selection owner when using incremental transfers, use
<a class="xref" href="#XtOwnSelectionIncremental"><code class="function">XtOwnSelectionIncremental</code></a>.
</p><div class="funcsynopsis"><a id="XtOwnSelectionIncremental"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtOwnSelectionIncremental</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">selection</var>, Time <var class="pdparam">time</var>, XtConvertSelectionIncrProc <var class="pdparam">convert_callback</var>, XtLoseSelectionIncrProc <var class="pdparam">lose_callback</var>, XtSelectionDoneIncrProc <var class="pdparam">done_callback</var>, XtCancelConvertSelectionProc <var class="pdparam">cancel_callback</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget that wishes to become the owner. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom that names the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the
selection ownership request was initiated. This should be
the timestamp of the event that triggered ownership; the value
<code class="function">CurrentTime</code>
is not acceptable.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>convert_callback</em></span>
</span></p></td><td><p>
Specifies the procedure to be called whenever
the current value of the selection is requested.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>lose_callback</em></span>
</span></p></td><td><p>
Specifies the procedure to be called whenever
the widget has lost selection ownership, or NULL if the
owner is not interested in being notified.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>done_callback</em></span>
</span></p></td><td><p>
Specifies the procedure called after the
requestor has received the entire selection, or NULL if
the owner is not interested in being notified.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>cancel_callback</em></span>
</span></p></td><td><p>
Specifies the callback procedure to be called
when a selection request aborts because a timeout expires,
or NULL if the owner is not interested in being notified.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the argument to be passed to each of
the callback procedures when they are called.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtOwnSelectionIncremental"><code class="function">XtOwnSelectionIncremental</code></a>
procedure informs the Intrinsics
incremental selection mechanism that the specified widget wishes to
own the selection. It returns
<code class="function">True</code>
if the specified widget successfully becomes the selection owner or
<code class="function">False</code>
otherwise.
For more information about <span class="emphasis"><em>selection</em></span>, <span class="emphasis"><em>target</em></span>, and
<span class="emphasis"><em>time</em></span>, see
<span class="olink">Section 2.6</span> in the
<span class="olink">Inter-Client Communication Conventions Manual.</span>
</p><p>
If a done_callback procedure is specified, the client owns the storage allocated
for passing the value to the Intrinsics. If <span class="emphasis"><em>done_callback</em></span> is NULL,
the convert_callback procedure must allocate storage using
<a class="xref" href="#XtMalloc"><code class="function">XtMalloc</code></a>,
<a class="xref" href="#XtRealloc"><code class="function">XtRealloc</code></a>,
or
<a class="xref" href="#XtCalloc"><code class="function">XtCalloc</code></a>,
and the final value specified is freed by the
Intrinsics when the transfer is complete. After a selection transfer
has started, only one of the done_callback or cancel_callback
procedures is invoked to indicate completion of the transfer.
</p><p>
The lose_callback procedure does not indicate completion of any in-progress
transfers; it is invoked at the time a
<code class="function">SelectionClear</code>
event is dispatched regardless of any active transfers, which are still
expected to continue.
</p><p>
A widget that becomes the selection owner using
<a class="xref" href="#XtOwnSelectionIncremental"><code class="function">XtOwnSelectionIncremental</code></a>
may use
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>
to relinquish selection ownership.
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Setting_and_Retrieving_Selection_Target_Parameters"></a>Setting and Retrieving Selection Target Parameters</h3></div></div></div><p>
To specify target parameters for a selection request with a single target,
use
<a class="xref" href="#XtSetSelectionParameters"><code class="function">XtSetSelectionParameters</code></a>.
</p><div class="funcsynopsis"><a id="XtSetSelectionParameters"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetSelectionParameters</strong>(</code>Widget <var class="pdparam">requestor</var>, Atom <var class="pdparam">selection</var>, Atom <var class="pdparam">type</var>, XtPointer <var class="pdparam">value</var>, unsigned long <var class="pdparam">length</var>, int <var class="pdparam">format</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>requestor</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the atom that names the selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the type of the property in which the parameters are passed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value</em></span>
</span></p></td><td><p>
Specifies a pointer to the parameters.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>length</em></span>
</span></p></td><td><p>
Specifies the number of elements containing data in <span class="emphasis"><em>value</em></span>,
each element of a size indicated by <span class="emphasis"><em>format</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>format</em></span>
</span></p></td><td><p>
Specifies the size in bits of the data in the elements of <span class="emphasis"><em>value</em></span>.
</p></td></tr></tbody></table></div><p>
The specified parameters are copied and stored in a new property
of the specified type and format on the requestor's window. To initiate
a selection request with a target and these parameters, a subsequent
call to
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
or to
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
specifying the same requestor widget and selection atom will generate a
<code class="function">ConvertSelection</code>
request referring to the property containing the parameters. If
<a class="xref" href="#XtSetSelectionParameters"><code class="function">XtSetSelectionParameters</code></a>
is called more than once with the same widget and selection without
a call to specify a request, the most recently specified parameters
are used in the subsequent request.
</p><p>
The possible values of <span class="emphasis"><em>format</em></span> are 8, 16, or 32. If the format is 8,
the elements of <span class="emphasis"><em>value</em></span> are assumed to be sizeof(char);
if 16, sizeof(short); if 32, sizeof(long).
</p><p>
To generate a MULTIPLE
target request with parameters for any of the multiple targets of the
selection request, precede individual calls to
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>
and
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
with corresponding individual calls to
<a class="xref" href="#XtSetSelectionParameters"><code class="function">XtSetSelectionParameters</code></a>,
and enclose these all within
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>
and
<code class="function">XtSendSelectionRequest.</code>
<a class="xref" href="#XtGetSelectionValues"><code class="function">XtGetSelectionValues</code></a>
and
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>
cannot be used to make selection requests with parameterized targets.
</p><p>
To retrieve any target parameters needed to perform a selection conversion,
the selection owner calls
<a class="xref" href="#XtGetSelectionParameters"><code class="function">XtGetSelectionParameters</code></a>.
</p><div class="funcsynopsis"><a id="XtGetSelectionParameters"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetSelectionParameters</strong>(</code>Widget <var class="pdparam">owner</var>, Atom <var class="pdparam">selection</var>, XtRequestId <var class="pdparam">request_id</var>, Atom *<var class="pdparam">type_return</var>, XtPointer *<var class="pdparam">value_return</var>, unsigned long *<var class="pdparam">length_return</var>, int *<var class="pdparam">format_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>owner</em></span>
</span></p></td><td><p>
Specifies the widget that owns the specified selection.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the selection being processed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>request_id</em></span>
</span></p></td><td><p>
Specifies the requestor id in the case of incremental selections,
or NULL in the case of atomic transfers.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type_return</em></span>
</span></p></td><td><p>
Specifies a pointer to an atom in which the property type
of the parameters is stored.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>value_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which a pointer to the parameters is to be stored.
A NULL is stored if no parameters accompany the request.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>length_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which the number of data elements
in <span class="emphasis"><em>value_return</em></span> of size indicated by <span class="emphasis"><em>format_return</em></span> are stored.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>format_return</em></span>
</span></p></td><td><p>
Specifies a pointer into which the size in bits of the parameter data
in the elements of <span class="emphasis"><em>value</em></span> is stored.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGetSelectionParameters"><code class="function">XtGetSelectionParameters</code></a>
may be called only from within an
<a class="xref" href="#XtConvertSelectionProc"><code class="function">(*XtConvertSelectionProc)</code></a>
or from within the first call to an
<a class="xref" href="#XtConvertSelectionIncrProc"><code class="function">(*XtConvertSelectionIncrProc)</code></a>
with a new request_id.
</p><p>
It is the responsibility of the caller to free the returned parameters using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when the parameters are no longer needed.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Generating_MULTIPLE_Requests"></a>Generating MULTIPLE Requests</h3></div></div></div><p>
To have the Intrinsics bundle multiple calls to make selection requests into
a single request using a <span class="strong"><strong>MULTIPLE</strong></span> target, use
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>
and
<a class="xref" href="#XtSendSelectionRequest"><code class="function">XtSendSelectionRequest</code></a>.
</p><div class="funcsynopsis"><a id="XtCreateSelectionRequest"></a><p><code class="funcdef">void <strong class="fsfunc">XtCreateSelectionRequest</strong>(</code>Widget <var class="pdparam">requestor</var>, Atom <var class="pdparam">selection</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>requestor</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the particular selection desired.
</p></td></tr></tbody></table></div><p>
When
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>
is called, subsequent calls to
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>,
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>,
<a class="xref" href="#XtGetSelectionValues"><code class="function">XtGetSelectionValues</code></a>,
and
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>,
with the requestor and selection as specified to
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>,
are bundled into a single selection request with
multiple targets. The request is made by calling
<a class="xref" href="#XtSendSelectionRequest"><code class="function">XtSendSelectionRequest</code></a>.
</p><div class="funcsynopsis"><a id="XtSendSelectionRequest"></a><p><code class="funcdef">void <strong class="fsfunc">XtSendSelectionRequest</strong>(</code>Widget <var class="pdparam">requestor</var>, Atom <var class="pdparam">selection</var>, Time <var class="pdparam">time</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>requestor</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the particular selection desired.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>time</em></span>
</span></p></td><td><p>
Specifies the timestamp that indicates when the selection request was
initiated. The value
<code class="function">CurrentTime</code>
is not acceptable.
</p></td></tr></tbody></table></div><p>
When
<a class="xref" href="#XtSendSelectionRequest"><code class="function">XtSendSelectionRequest</code></a>
is called with a value of <span class="emphasis"><em>requestor</em></span> and <span class="emphasis"><em>selection</em></span> matching
a previous call to
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>,
a selection request is sent to the selection owner.
If a single target request is queued, that request is made.
If multiple targets are queued, they are bundled into a single request
with a target of MULTIPLE using the specified timestamp.
As the values are returned, the callbacks specified in
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>,
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>,
<a class="xref" href="#XtGetSelectionValues"><code class="function">XtGetSelectionValues</code></a>,
and
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>
are invoked.
</p><p>
Multi-threaded applications should lock the application context before
calling
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>
and release the lock after calling
<a class="xref" href="#XtSendSelectionRequest"><code class="function">XtSendSelectionRequest</code></a>
to ensure that the thread assembling the request is safe from interference
by another thread assembling a different request naming the same widget
and selection.
</p><p>
To relinquish the composition of a MULTIPLE request without sending it, use
<a class="xref" href="#XtCancelSelectionRequest"><code class="function">XtCancelSelectionRequest</code></a>.
</p><div class="funcsynopsis"><a id="XtCancelSelectionRequest"></a><p><code class="funcdef">void <strong class="fsfunc">XtCancelSelectionRequest</strong>(</code>Widget <var class="pdparam">requestor</var>, Atom <var class="pdparam">selection</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>requestor</em></span>
</span></p></td><td><p>
Specifies the widget making the request. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>selection</em></span>
</span></p></td><td><p>
Specifies the particular selection desired.
</p></td></tr></tbody></table></div><p>
When
<a class="xref" href="#XtCancelSelectionRequest"><code class="function">XtCancelSelectionRequest</code></a>
is called, any requests queued since the last call to
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>
for the same widget and selection are discarded
and any resources reserved are released.
A subsequent call to
<a class="xref" href="#XtSendSelectionRequest"><code class="function">XtSendSelectionRequest</code></a>
will not result in any request being made.
Subsequent calls to
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>,
<a class="xref" href="#XtGetSelectionValues"><code class="function">XtGetSelectionValues</code></a>,
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>,
or
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>
will not be deferred.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Auxiliary_Selection_Properties"></a>Auxiliary Selection Properties</h3></div></div></div><p>
Certain uses of parameterized selections require clients to name
other window properties within a selection parameter. To permit
reuse of temporary property names in these circumstances and
thereby reduce the number of unique atoms created in the server,
the Intrinsics provides two interfaces for acquiring temporary property names.
</p><p>
To acquire a temporary property name atom for use in a selection
request, the client may call
<a class="xref" href="#XtReservePropertyAtom"><code class="function">XtReservePropertyAtom</code></a>.
</p><div class="funcsynopsis"><a id="XtReservePropertyAtom"></a><p><code class="funcdef">Atom <strong class="fsfunc">XtReservePropertyAtom</strong>(</code>Widget <var class="pdparam">w</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget making a selection request.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtReservePropertyAtom"><code class="function">XtReservePropertyAtom</code></a>
returns an atom that may be used as a property name during selection
requests involving the specified widget.
As long as the atom remains reserved, it is unique with respect to all
other reserved atoms for the widget.
</p><p>
To return a temporary property name atom for reuse and to delete
the property named by that atom, use
<a class="xref" href="#XtReleasePropertyAtom"><code class="function">XtReleasePropertyAtom</code></a>.
</p><div class="funcsynopsis"><a id="XtReleasePropertyAtom"></a><p><code class="funcdef">void <strong class="fsfunc">XtReleasePropertyAtom</strong>(</code>Widget <var class="pdparam">w</var>, Atom <var class="pdparam">atom</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget used to reserve the property name atom.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>atom</em></span>
</span></p></td><td><p>
Specifies the property name atom returned by
<a class="xref" href="#XtReservePropertyAtom"><code class="function">XtReservePropertyAtom</code></a>
that is to be released for reuse.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtReleasePropertyAtom"><code class="function">XtReleasePropertyAtom</code></a>
marks the specified property name atom as
no longer in use and ensures that any property having that name
on the specified widget's window is deleted. If <span class="emphasis"><em>atom</em></span> does not
specify a value returned by
<a class="xref" href="#XtReservePropertyAtom"><code class="function">XtReservePropertyAtom</code></a>
for the specified widget, the results are undefined.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Retrieving_the_Most_Recent_Timestamp"></a>Retrieving the Most Recent Timestamp</h3></div></div></div><p>
To retrieve the timestamp from the most recent call to
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
that contained a timestamp, use
<a class="xref" href="#XtLastTimestampProcessed"><code class="function">XtLastTimestampProcessed</code></a>.
</p><div class="funcsynopsis"><a id="XtLastTimestampProcessed"></a><p><code class="funcdef">Time <strong class="fsfunc">XtLastTimestampProcessed</strong>(</code>Display *<var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies an open display connection.
</p></td></tr></tbody></table></div><p>
If no
<code class="function">KeyPress</code>,
<code class="function">KeyRelease</code>,
<code class="function">ButtonPress</code>,
<code class="function">ButtonRelease</code>,
<code class="function">MotionNotify</code>,
<code class="function">EnterNotify</code>,
<code class="function">LeaveNotify</code>,
<code class="function">PropertyNotify</code>,
or
<code class="function">SelectionClear</code>
event has yet been passed to
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
for the specified display,
<a class="xref" href="#XtLastTimestampProcessed"><code class="function">XtLastTimestampProcessed</code></a>
returns zero.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Retrieving_the_Most_Recent_Event"></a>Retrieving the Most Recent Event</h3></div></div></div><p>
To retrieve the event from the most recent call to
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
for a specific display, use
<a class="xref" href="#XtLastEventProcessed"><code class="function">XtLastEventProcessed</code></a>.
</p><div class="funcsynopsis"><a id="XtLastEventProcessed"></a><p><code class="funcdef">XEvent *<strong class="fsfunc">XtLastEventProcessed</strong>(</code>Display *<var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display connection from which to retrieve the event.
</p></td></tr></tbody></table></div><p>
Returns the last event passed to
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
for the specified display. Returns NULL if there is no such event.
The client must not modify the contents of the returned event.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Merging_Exposure_Events_into_a_Region"></a>Merging Exposure Events into a Region</h2></div></div></div><p>
The Intrinsics provide an
<a class="xref" href="#XtAddExposureToRegion"><code class="function">XtAddExposureToRegion</code></a>
utility function that merges
<code class="function">Expose</code>
and
<code class="function">GraphicsExpose</code>
events into a region for clients to process at once
rather than processing individual rectangles.
For further information about regions,
see <span class="olink">????</span>
in <span class="olink">
Xlib — C Language X Interface.</span>.
</p><p>
To merge
<code class="function">Expose</code>
and
<code class="function">GraphicsExpose</code>
events into a region, use
<a class="xref" href="#XtAddExposureToRegion"><code class="function">XtAddExposureToRegion</code></a>.
</p><div class="funcsynopsis"><a id="XtAddExposureToRegion"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddExposureToRegion</strong>(</code>XEvent *<var class="pdparam">event</var>, Region <var class="pdparam">region</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>event</em></span>
</span></p></td><td><p>
Specifies a pointer to the
<code class="function">Expose</code>
or
<code class="function">GraphicsExpose</code>
event.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>region</em></span>
</span></p></td><td><p>
Specifies the region object (as defined in
<code class="function"><X11/Xutil.h></code>).
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAddExposureToRegion"><code class="function">XtAddExposureToRegion</code></a>
function computes the union of the rectangle defined by the exposure
event and the specified region.
Then it stores the results back in <span class="emphasis"><em>region</em></span>.
If the event argument is not an
<code class="function">Expose</code>
or
<code class="function">GraphicsExpose</code>
event,
<a class="xref" href="#XtAddExposureToRegion"><code class="function">XtAddExposureToRegion</code></a>
returns without an error and without modifying <span class="emphasis"><em>region</em></span>.
</p><p>
This function is used by the exposure compression mechanism;
see <a class="xref" href="#Exposure_Compression" title="Exposure Compression">the section called “Exposure Compression”</a>
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Translating_Widget_Coordinates"></a>Translating Widget Coordinates</h2></div></div></div><p>
To translate an x-y coordinate pair from widget coordinates to root
window absolute coordinates, use
<a class="xref" href="#XtTranslateCoords"><code class="function">XtTranslateCoords</code></a>.
</p><div class="funcsynopsis"><a id="XtTranslateCoords"></a><p><code class="funcdef">void <strong class="fsfunc">XtTranslateCoords</strong>(</code>Widget <var class="pdparam">w</var>, Position <var class="pdparam">x</var>, Position *<var class="pdparam">rootx_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget. Must be of class RectObj or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>x</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>y</em></span>
</span></p></td><td><p>
Specify the widget-relative x and y coordinates.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>rootx_return</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>rooty_return</em></span>
</span></p></td><td><p>
Return the root-relative x and y coordinates.
</p></td></tr></tbody></table></div><p>
While
<a class="xref" href="#XtTranslateCoords"><code class="function">XtTranslateCoords</code></a>
is similar to the Xlib
<code class="function">XTranslateCoordinates</code>
function, it does not generate a server request because all the required
information already is in the widget's data structures.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Translating_a_Window_to_a_Widget"></a>Translating a Window to a Widget</h2></div></div></div><p>
To translate a given window and display pointer into a widget instance, use
<a class="xref" href="#XtWindowToWidget"><code class="function">XtWindowToWidget</code></a>.
</p><div class="funcsynopsis"><a id="XtWindowToWidget"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtWindowToWidget</strong>(</code>Display *<var class="pdparam">display</var>, Window <var class="pdparam">window</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display on which the window is defined.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>window</em></span>
</span></p></td><td><p>
Specifies the drawable for which you want the widget.
</p></td></tr></tbody></table></div><p>
If there is a realized widget whose window is the specified drawable on
the specified <span class="emphasis"><em>display</em></span>,
<a class="xref" href="#XtWindowToWidget"><code class="function">XtWindowToWidget</code></a>
returns that widget.
If not and if the drawable has been associated with a widget through
<a class="xref" href="#XtRegisterDrawable"><code class="function">XtRegisterDrawable</code></a>,
<a class="xref" href="#XtWindowToWidget"><code class="function">XtWindowToWidget</code></a>
returns the widget associated with the drawable. In other cases it
returns NULL.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Handling_Errors"></a>Handling Errors</h2></div></div></div><p>
The Intrinsics allow a client to register procedures that are called
whenever a fatal or nonfatal error occurs.
These facilities are intended for both error reporting and logging
and for error correction or recovery.
</p><p>
Two levels of interface are provided:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A high-level interface that takes an error
name and class and retrieves the error message text from
an error resource database.
</p></li><li class="listitem"><p>
A low-level interface that takes a simple string to display.
</p></li></ul></div><p>
The high-level functions construct a string to pass to the lower-level
interface.
The strings may be specified in application code and are
overridden by the contents of an external systemwide file,
the "error database file". The location and name of this file are
implementation-dependent.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
The application-context-specific error handling is not
implemented on many systems, although the interfaces are
always present.
Most implementations will have just one set of error handlers
for all application contexts within a process.
If they are set for different application contexts,
the ones registered last will prevail.
</p></div><p>
To obtain the error database (for example, to merge with
an application- or widget-specific database), use
<a class="xref" href="#XtAppGetErrorDatabase"><code class="function">XtAppGetErrorDatabase</code></a>.
</p><div class="funcsynopsis"><a id="XtAppGetErrorDatabase"></a><p><code class="funcdef">XrmDatabase *<strong class="fsfunc">XtAppGetErrorDatabase</strong>(</code>XtAppContext <var class="pdparam">app_context</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppGetErrorDatabase"><code class="function">XtAppGetErrorDatabase</code></a>
function returns the address of the error database.
The Intrinsics do a lazy binding of the error database and do not merge in the
database file until the first call to
<a class="xref" href="#XtAppGetErrorDatabaseText"><code class="function">XtAppGetErrorDatabaseText</code></a>.
</p><p>
For a complete listing of all errors and warnings
that can be generated by the Intrinsics, see <a class="xref" href="#Intrinsics_Error_Messages" title="Appendix D. Intrinsics Error Messages">Appendix D, <em>Intrinsics Error Messages</em></a>
</p><p>
The high-level error and warning handler procedure pointers are of type
<a class="xref" href="#XtErrorMsgHandler"><code class="function">(*XtErrorMsgHandler)</code></a>.
</p><div class="funcsynopsis"><a id="XtErrorMsgHandler"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtErrorMsgHandler)</strong>(</code>String <var class="pdparam">name</var>, String <var class="pdparam">type</var>, String <var class="pdparam">class</var>, String <var class="pdparam">defaultp</var>, String *<var class="pdparam">params</var>, Cardinal *<var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the name to be concatenated with the specified type to form
the resource name of the error message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the type to be concatenated with the name to form the
resource name of the error message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the resource class of the error message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>defaultp</em></span>
</span></p></td><td><p>
Specifies the default message to use if no error database entry is found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies a pointer to a list of parameters to be substituted in the message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><p>
The specified name can be a general kind of error,
like "invalidParameters" or "invalidWindow",
and the specified type gives extra information
such as the name of the routine in which the error was detected.
Standard
<code class="function">printf</code>
notation is used to substitute the parameters into the message.
</p><p>
An error message handler can obtain the error database text for an
error or a warning by calling
<a class="xref" href="#XtAppGetErrorDatabaseText"><code class="function">XtAppGetErrorDatabaseText</code></a>.
</p><div class="funcsynopsis"><a id="XtAppGetErrorDatabaseText"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppGetErrorDatabaseText</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">name</var>, String <var class="pdparam">default</var>, String <var class="pdparam">buffer_return</var>, int <var class="pdparam">nbytes</var>, XrmDatabase <var class="pdparam">database</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
, </span><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specify the name and type concatenated to form the resource name
of the error message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the resource class of the error message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>default</em></span>
</span></p></td><td><p>
Specifies the default message to use if an error database entry is not found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>buffer_return</em></span>
</span></p></td><td><p>
Specifies the buffer into which the error message is to be returned.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nbytes</em></span>
</span></p></td><td><p>
Specifies the size of the buffer in bytes.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>database</em></span>
</span></p></td><td><p>
Specifies the name of the alternative database to be used,
or NULL if the application context's error database is to be used.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppGetErrorDatabaseText"><code class="function">XtAppGetErrorDatabaseText</code></a>
returns the appropriate message from the error database
or returns the specified default message if one is not found in the
error database.
To form the full resource name and class when querying the database,
the <span class="emphasis"><em>name</em></span> and <span class="emphasis"><em>type</em></span> are concatenated with a single "."
between them and the <span class="emphasis"><em>class</em></span> is concatenated with itself with a
single "." if it does not already contain a ".".
</p><p>
To return the application name and class as passed to
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
for a particular Display, use
<a class="xref" href="#XtGetApplicationNameAndClass"><code class="function">XtGetApplicationNameAndClass</code></a>.
</p><div class="funcsynopsis"><a id="XtGetApplicationNameAndClass"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetApplicationNameAndClass</strong>(</code>Display* <var class="pdparam">display</var>, String* <var class="pdparam">name_return</var>, String* <var class="pdparam">class_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies an open display connection that has been initialized with
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>name_return</em></span>
</span></p></td><td><p>
Returns the application name.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class_return</em></span>
</span></p></td><td><p>
Returns the application class.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGetApplicationNameAndClass"><code class="function">XtGetApplicationNameAndClass</code></a>
returns the application name and class passed to
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
for the specified display. If the display was
never initialized or has been closed, the result is undefined. The
returned strings are owned by the Intrinsics and must not be modified
or freed by the caller.
</p><p>
To register a procedure to be called on fatal error conditions, use
<a class="xref" href="#XtAppSetErrorMsgHandler"><code class="function">XtAppSetErrorMsgHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtAppSetErrorMsgHandler"></a><p><code class="funcdef">XtErrorMsgHandler <strong class="fsfunc">XtAppSetErrorMsgHandler</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtErrorMsgHandler <var class="pdparam">msg_handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>msg_handler</em></span>
</span></p></td><td><p>
Specifies the new fatal error procedure, which should not return.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppSetErrorMsgHandler"><code class="function">XtAppSetErrorMsgHandler</code></a>
returns a pointer to the previously
installed high-level fatal error handler.
The default high-level fatal error handler provided by the Intrinsics is named
<code class="function">_XtDefaultErrorMsg</code>
and constructs a string from the error resource database and calls
<a class="xref" href="#XtError"><code class="function">XtError</code></a>.
Fatal error message handlers should not return.
If one does,
subsequent Intrinsics behavior is undefined.
</p><p>
To call the high-level error handler, use
<a class="xref" href="#XtAppErrorMsg"><code class="function">XtAppErrorMsg</code></a>.
</p><div class="funcsynopsis"><a id="XtAppErrorMsg"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppErrorMsg</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">name</var>, String <var class="pdparam">type</var>, String <var class="pdparam">class</var>, String <var class="pdparam">default</var>, String *<var class="pdparam">params</var>, Cardinal *<var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the general kind of error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the detailed name of the error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the resource class.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>default</em></span>
</span></p></td><td><p>
Specifies the default message to use if an error database entry is not found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies a pointer to a list of values to be stored in the message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><p>
The Intrinsics internal errors all have class
"XtToolkitError".
</p><p>
To register a procedure to be called on nonfatal error conditions, use
<a class="xref" href="#XtAppSetWarningMsgHandler"><code class="function">XtAppSetWarningMsgHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtAppSetWarningMsgHandler"></a><p><code class="funcdef">XtErrorMsgHandler <strong class="fsfunc">XtAppSetWarningMsgHandler</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtErrorMsgHandler <var class="pdparam">msg_handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>msg_handler</em></span>
</span></p></td><td><p>
Specifies the new nonfatal error procedure, which usually returns.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppSetWarningMsgHandler"><code class="function">XtAppSetWarningMsgHandler</code></a>
returns a pointer to the previously
installed high-level warning handler.
The default high-level warning handler provided by the Intrinsics is named
<code class="function">_XtDefaultWarningMsg</code>
and constructs a string
from the error resource database and calls
<a class="xref" href="#XtWarning"><code class="function">XtWarning</code></a>.
</p><p>
To call the installed high-level warning handler, use
<a class="xref" href="#XtAppWarningMsg"><code class="function">XtAppWarningMsg</code></a>.
</p><div class="funcsynopsis"><a id="XtAppWarningMsg"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppWarningMsg</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">name</var>, String <var class="pdparam">type</var>, String <var class="pdparam">class</var>, String <var class="pdparam">default</var>, String *<var class="pdparam">params</var>, Cardinal *<var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the general kind of error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the detailed name of the error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the resource class.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>default</em></span>
</span></p></td><td><p>
Specifies the default message to use if an error database entry is not found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies a pointer to a list of values to be stored in the message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><p>
The Intrinsics internal warnings all have class
"XtToolkitError".
</p><p>
The low-level error and warning handler procedure pointers are of type
<a class="xref" href="#XtErrorHandler"><code class="function">(*XtErrorHandler)</code></a>.
</p><div class="funcsynopsis"><a id="XtErrorHandler"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtErrorHandler)</strong>(</code>String <var class="pdparam">message</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>message</em></span>
</span></p></td><td><p>
Specifies the error message.
</p></td></tr></tbody></table></div><p>
The error handler should display the message string in some appropriate fashion.
</p><p>
To register a procedure to be called on fatal error conditions, use
<a class="xref" href="#XtAppSetErrorHandler"><code class="function">XtAppSetErrorHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtAppSetErrorHandler"></a><p><code class="funcdef">XtErrorHandler <strong class="fsfunc">XtAppSetErrorHandler</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtErrorHandler <var class="pdparam">handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>handler</em></span>
</span></p></td><td><p>
Specifies the new fatal error procedure, which should not return.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppSetErrorHandler"><code class="function">XtAppSetErrorHandler</code></a>
returns a pointer to the previously installed
low-level fatal error handler.
The default low-level error handler provided by the Intrinsics is
<code class="function">_XtDefaultError</code>.
On POSIX-based systems,
it prints the message to standard error and terminates the application.
Fatal error message handlers should not return.
If one does,
subsequent Intrinsics behavior is undefined.
</p><p>
To call the installed fatal error procedure, use
<a class="xref" href="#XtAppError"><code class="function">XtAppError</code></a>.
</p><div class="funcsynopsis"><a id="XtAppError"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppError</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">message</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>message</em></span>
</span></p></td><td><p>
Specifies the message to be reported.
</p></td></tr></tbody></table></div><p>
Most programs should use
<a class="xref" href="#XtAppErrorMsg"><code class="function">XtAppErrorMsg</code></a>,
not
<a class="xref" href="#XtAppError"><code class="function">XtAppError</code></a>,
to provide for customization and internationalization of error messages.
</p><p>
To register a procedure to be called on nonfatal error conditions, use
<a class="xref" href="#XtAppSetWarningHandler"><code class="function">XtAppSetWarningHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtAppSetWarningHandler"></a><p><code class="funcdef">XtErrorHandler <strong class="fsfunc">XtAppSetWarningHandler</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, XtErrorHandler <var class="pdparam">handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>handler</em></span>
</span></p></td><td><p>
Specifies the new nonfatal error procedure, which usually returns.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppSetWarningHandler"><code class="function">XtAppSetWarningHandler</code></a>
returns a pointer to the previously installed
low-level warning handler.
The default low-level warning handler provided by the Intrinsics is
<code class="function">_XtDefaultWarning</code>.
On POSIX-based systems,
it prints the message to standard error and returns to the caller.
</p><p>
To call the installed nonfatal error procedure, use
<a class="xref" href="#XtAppWarning"><code class="function">XtAppWarning</code></a>.
</p><div class="funcsynopsis"><a id="XtAppWarning"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppWarning</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">message</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>message</em></span>
</span></p></td><td><p>
Specifies the nonfatal error message to be reported.
</p></td></tr></tbody></table></div><p>
Most programs should use
<a class="xref" href="#XtAppWarningMsg"><code class="function">XtAppWarningMsg</code></a>,
not
<a class="xref" href="#XtAppWarning"><code class="function">XtAppWarning</code></a>,
to provide for customization and internationalization of warning messages.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Setting_WM_COLORMAP_WINDOWS"></a>Setting WM_COLORMAP_WINDOWS</h2></div></div></div><p>
A client may set the value of the <span class="strong"><strong>WM_COLORMAP_WINDOWS</strong></span>
property on a widget's window by calling
<a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>.
</p><div class="funcsynopsis"><a id="XtSetWMColormapWindows"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetWMColormapWindows</strong>(</code>Widget <var class="pdparam">widget</var>, Widget* <var class="pdparam">list</var>, Cardinal <var class="pdparam">count</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>widget</em></span>
</span></p></td><td><p>
Specifies the widget on whose window the <span class="strong"><strong>WM_COLORMAP_WINDOWS</strong></span>
property is stored. Must be of class Core or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>list</em></span>
</span></p></td><td><p>
Specifies a list of widgets whose windows are potentially to be
listed in the <span class="strong"><strong>WM_COLORMAP_WINDOWS</strong></span> property.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>count</em></span>
</span></p></td><td><p>
Specifies the number of widgets in <span class="emphasis"><em>list</em></span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>
returns immediately if <span class="emphasis"><em>widget</em></span> is not realized or if <span class="emphasis"><em>count</em></span> is 0.
Otherwise,
<a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>
constructs an ordered list of windows
by examining each widget in <span class="emphasis"><em>list</em></span> in turn and
ignoring the widget if it is not realized, or
adding the widget's window to the window list if the widget is realized
and if its colormap resource is different from the colormap
resources of all widgets whose windows are already on the window list.
</p><p>
Finally,
<a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>
stores the resulting window list in the <span class="strong"><strong>WM_COLORMAP_WINDOWS</strong></span>
property on the specified widget's window.
Refer to Section 4.1.8 in the <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span> for details of
the semantics of the <span class="strong"><strong>WM_COLORMAP_WINDOWS</strong></span> property.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Finding_File_Names"></a>Finding File Names</h2></div></div></div><p>
The Intrinsics provide procedures to look for a file by name, allowing
string substitutions in a list of file specifications. Two
routines are provided for this:
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>
and
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>.
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>
uses an arbitrary set of client-specified substitutions, and
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>
uses a set of standard substitutions corresponding
to the <span class="emphasis"><em>X/Open Portability Guide</em></span> language localization conventions.
Most applications should use
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>.
</p><p>
A string substitution is defined by a list of
<code class="function">Substitution</code>
entries.
</p><div class="literallayout"><p><br />
typedef struct {<br />
char match;<br />
String substitution;<br />
} SubstitutionRec, *Substitution;<br />
</p></div><p>
File name evaluation is handled in an operating-system-dependent
fashion by an
<a class="xref" href="#XtFilePredicate"><code class="function">(*XtFilePredicate)</code></a>
procedure.
</p><div class="funcsynopsis"><a id="XtFilePredicate"></a><p><code class="funcdef">typedef Boolean <strong class="fsfunc">(*XtFilePredicate)</strong>(</code>String <var class="pdparam">filename</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>filename</em></span>
</span></p></td><td><p>
Specifies a potential filename.
</p></td></tr></tbody></table></div><p>
A file predicate procedure is called with a string that is
potentially a file name. It should return
<code class="function">True</code>
if this string specifies a file that is appropriate for the intended use and
<code class="function">False</code>
otherwise.
</p><p>
To search for a file using substitutions in a path list, use
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>.
</p><div class="funcsynopsis"><a id="XtFindFile"></a><p><code class="funcdef">String <strong class="fsfunc">XtFindFile</strong>(</code>String <var class="pdparam">path</var>, Substitution <var class="pdparam">substitutions</var>, Cardinal <var class="pdparam">num_substitutions</var>, XtFilePredicate <var class="pdparam">predicate</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>path</em></span>
</span></p></td><td><p>
Specifies a path of file names, including substitution characters.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>substitutions</em></span>
</span></p></td><td><p>
Specifies a list of substitutions to make into the path.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_substitutions</em></span>
</span></p></td><td><p>
Specifies the number of substitutions passed in.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>predicate</em></span>
</span></p></td><td><p>
Specifies a procedure called to judge each potential file name, or NULL.
</p></td></tr></tbody></table></div><p>
The <span class="emphasis"><em>path</em></span> parameter specifies a string that consists of a series of
potential file names delimited by colons. Within each name, the
percent character specifies a string substitution selected by the
following character. The character sequence "%:" specifies an
embedded colon that is not a delimiter; the sequence is replaced by a
single colon. The character sequence "%%" specifies a percent
character that does not introduce a substitution; the sequence is
replaced by a single percent character. If a percent character is
followed by any other character,
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>
looks through the
specified <span class="emphasis"><em>substitutions</em></span> for that character in the <span class="emphasis"><em>match</em></span> field
and, if found,
replaces the percent and match characters with the string in the
corresponding <span class="emphasis"><em>substitution</em></span> field. A <span class="emphasis"><em>substitution</em></span> field entry of NULL
is equivalent to a pointer to an empty string. If the operating
system does not interpret multiple embedded name separators in the
path (i.e., "/" in POSIX) the same way as a single separator,
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>
will collapse multiple separators into a single one after performing
all string substitutions. Except for collapsing embedded separators,
the contents of the string substitutions are not interpreted by
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>
and may therefore contain any operating-system-dependent
characters, including additional name separators. Each resulting
string is passed to the predicate procedure until a string is found for
which the procedure returns
<code class="function">True</code>;
this string is the return value for
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>.
If no string yields a
<code class="function">True</code>
return from the predicate,
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>
returns NULL.
</p><p>
If the <span class="emphasis"><em>predicate</em></span> parameter is NULL, an internal procedure that checks
if the file exists, is readable, and is not a directory is used.
</p><p>
It is the responsibility of the caller to free the returned string using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is no longer needed.
</p><p>
To search for a file using standard substitutions in a path list, use
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>.
</p><div class="funcsynopsis"><a id="XtResolvePathname"></a><p><code class="funcdef">String <strong class="fsfunc">XtResolvePathname</strong>(</code>Display *<var class="pdparam">display</var>, String <var class="pdparam">type</var>, Substitution <var class="pdparam">substitutions</var>, Cardinal <var class="pdparam">num_substitutions</var>, XtFilePredicate <var class="pdparam">predicate</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the display to use to find the language for language substitutions.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>filename</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>suffix</em></span>
</span></p></td><td><p>
Specify values to substitute into the path.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>path</em></span>
</span></p></td><td><p>
Specifies the list of file specifications, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>substitutions</em></span>
</span></p></td><td><p>
Specifies a list of additional substitutions to make into the path, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_substitutions</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>substitutions</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>predicate</em></span>
</span></p></td><td><p>
Specifies a procedure called to judge each potential file name, or NULL.
</p></td></tr></tbody></table></div><p>
The substitutions specified by
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>
are determined from the value of the language string retrieved by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
for the specified display.
To set the
language for all applications specify "*xnlLanguage: <span class="emphasis"><em>lang</em></span>" in the
resource database.
The format and content of the language string are
implementation-defined. One suggested syntax is to compose
the language string of three parts; a "language part", a
"territory part" and a "codeset part". The manner in which
this composition is accomplished is implementation-defined,
and the Intrinsics make no interpretation of the parts other
than to use them in substitutions as described below.
</p><p>
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>
calls
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>
with the following substitutions
in addition to any passed by the caller and returns the value returned by
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>:
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
%N
</span></p></td><td><p>
The value of the <span class="emphasis"><em>filename</em></span> parameter, or the application's
class name if <span class="emphasis"><em>filename</em></span> is NULL.
</p></td></tr><tr><td><p><span class="term">
%T
</span></p></td><td><p>
The value of the <span class="emphasis"><em>type</em></span> parameter.
</p></td></tr><tr><td><p><span class="term">
%S
</span></p></td><td><p>
The value of the <span class="emphasis"><em>suffix</em></span> parameter.
</p></td></tr><tr><td><p><span class="term">
%L
</span></p></td><td><p>
The language string associated with the specified display.
</p></td></tr><tr><td><p><span class="term">
%l
</span></p></td><td><p>
The language part of the display's language string.
</p></td></tr><tr><td><p><span class="term">
%t
</span></p></td><td><p>
The territory part of the display's language string.
</p></td></tr><tr><td><p><span class="term">
%c
</span></p></td><td><p>
The codeset part of the display's language string.
</p></td></tr><tr><td><p><span class="term">
%C
</span></p></td><td><p>
The customization string retrieved from the resource
database associated with <span class="emphasis"><em>display</em></span>.
</p></td></tr><tr><td><p><span class="term">
%D
</span></p></td><td><p>
The value of the implementation-specific default path.
</p></td></tr></tbody></table></div><p>
If a path is passed to
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>,
it is passed along to
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>.
If the <span class="emphasis"><em>path</em></span> argument is NULL, the value of the
<span class="strong"><strong>XFILESEARCHPATH</strong></span>
environment variable is passed to
<a class="xref" href="#XtFindFile"><code class="function">XtFindFile</code></a>.
If <span class="strong"><strong>XFILESEARCHPATH</strong></span>
is not defined, an implementation-specific default path is used
that contains at least six entries. These entries
must contain the following substitutions:
</p><div class="literallayout"><p><br />
1. %C, %N, %S, %T, %L or %C, %N, %S, %T, %l, %t, %c<br />
2. %C, %N, %S, %T, %l<br />
3. %C, %N, %S, %T<br />
4. %N, %S, %T, %L or %N, %S, %T, %l, %t, %c<br />
5. %N, %S, %T, %l<br />
6. %N, %S, %T<br />
</p></div><p>
The order of these six entries within the path must be as given above.
The order and use of substitutions within a given entry
are implementation-dependent.
If the path begins
with a colon, it is preceded by %N%S. If the path includes two
adjacent colons, <code class="function">%N%S</code> is inserted between them.
</p><p>
The <span class="emphasis"><em>type</em></span> parameter is intended to be a category of files, usually
being translated into a directory in the pathname. Possible values
might include "app-defaults", "help", and "bitmap".
</p><p>
The <span class="emphasis"><em>suffix</em></span> parameter is intended to be appended to the file name.
Possible values might include ".txt", ".dat", and ".bm".
</p><p>
A suggested value for the default path on POSIX-based systems is
</p><div class="literallayout"><p><br />
/usr/lib/X11/%L/%T/%N%C%S:/usr/lib/X11/%l/%T/%N%C%S:\<br />
/usr/lib/X11/%T/%N%C%S:/usr/lib/X11/%L/%T/%N%S:\<br />
/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S<br />
</p></div><p>
Using this example, if the user has specified a language, it is
used as a subdirectory of /usr/lib/X11 that is searched for other
files. If the desired file is not found there, the lookup is
tried again using just the language part of the specification. If the
file is not there, it is looked for in /usr/lib/X11. The <span class="emphasis"><em>type</em></span>
parameter is used as a subdirectory of the language directory or of
/usr/lib/X11, and <span class="emphasis"><em>suffix</em></span> is appended to the file name.
</p><p>
The %D substitution allows the addition of path
elements to the implementation-specific default path, typically to
allow additional directories to be searched without preventing
resources in the system directories from being found. For example, a
user installing resource files under a directory called "ourdir"
might set
<span class="strong"><strong>XFILESEARCHPATH</strong></span>
to
</p><div class="literallayout"><p><br />
%D:ourdir/%T/%N%C:ourdir/%T/%N<br />
</p></div><p>
The customization string is obtained by querying the resource database
currently associated with the display (the database returned by
<code class="function">XrmGetDatabase</code>)
for the resource <span class="emphasis"><em>application_name</em></span>.customization, class
<span class="emphasis"><em>application_class</em></span>.Customization, where <span class="emphasis"><em>application_name</em></span>
and <span class="emphasis"><em>application_class</em></span> are the values returned by
<a class="xref" href="#XtGetApplicationNameAndClass"><code class="function">XtGetApplicationNameAndClass</code></a>.
If no value is specified in the database, the empty string is used.
</p><p>
It is the responsibility of the caller to free the returned string using
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>
when it is no longer needed.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Hooks_for_External_Agents"></a>Hooks for External Agents</h2></div></div></div><p>
Applications may register
functions that are called at a particular control points in the Intrinsics.
These functions are intended to be used to provide notification
of an "X Toolkit event", such as widget creation, to an external agent,
such as an interactive resource editor, drag-and-drop server, or
an aid for physically challenged users.
The control points containing such registration hooks are identified
in a "hook registration" object.
</p><p>
To retrieve the hook registration widget, use
<a class="xref" href="#XtHooksOfDisplay"><code class="function">XtHooksOfDisplay</code></a>.
</p><div class="funcsynopsis"><a id="XtHooksOfDisplay"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtHooksOfDisplay</strong>(</code>Display *<var class="pdparam">display</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>display</em></span>
</span></p></td><td><p>
Specifies the desired display.
</p></td></tr></tbody></table></div><p>
The class of this object is a private, implementation-dependent
subclass of
<code class="function">Object</code>.
The hook object has no parent. The resources of this object are
the callback lists for hooks and the read-only resources for getting
a list of parentless shells. All of the callback lists are initially
empty. When a display is closed, the hook object associated with it
is destroyed.
</p><p>
The following procedures can be called with the hook registration object
as an argument:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtAddCallback"><code class="function">XtAddCallback</code></a>,
<a class="xref" href="#XtAddCallbacks"><code class="function">XtAddCallbacks</code></a>,
<a class="xref" href="#XtRemoveCallback"><code class="function">XtRemoveCallback</code></a>,
<a class="xref" href="#XtRemoveCallbacks"><code class="function">XtRemoveCallbacks</code></a>,
<a class="xref" href="#XtRemoveAllCallbacks"><code class="function">XtRemoveAllCallbacks</code></a>,
<a class="xref" href="#XtCallCallbacks"><code class="function">XtCallCallbacks</code></a>,
<a class="xref" href="#XtHasCallbacks"><code class="function">XtHasCallbacks</code></a>,
<a class="xref" href="#XtCallCallbackList"><code class="function">XtCallCallbackList</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtClass"><code class="function">XtClass</code></a>,
<code class="function">XtSuperclass</code>,
<a class="xref" href="#XtIsSubclass"><code class="function">XtIsSubclass</code></a>,
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>,
<code class="function">XtIsObject</code>,
<code class="function">XtIsRectObj</code>,
<code class="function">XtIsWidget</code>,
<code class="function">XtIsComposite</code>,
<code class="function">XtIsConstraint</code>,
<code class="function">XtIsShell</code>,
<code class="function">XtIsOverrideShell</code>,
<code class="function">XtIsWMShell</code>,
<code class="function">XtIsVendorShell</code>,
<code class="function">XtIsTransientShell</code>,
<code class="function">XtIsToplevelShell</code>,
<code class="function">XtIsApplicationShell</code>,
<code class="function">XtIsSessionShell</code>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtWidgetToApplicationContext"><code class="function">XtWidgetToApplicationContext</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtName"><code class="function">XtName</code></a>,
<code class="function">XtParent</code>,
<a class="xref" href="#XtDisplayOfObject"><code class="function">*XtDisplayOfObject</code></a>,
<a class="xref" href="#XtScreenOfObject"><code class="function">*XtScreenOfObject</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>,
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>,
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>,
<a class="xref" href="#XtVaGetValues"><code class="function">XtVaGetValues</code></a>
</p></li></ul></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Hook_Object_Resources"></a>Hook Object Resources</h3></div></div></div><p>
The resource names, classes, and representation types that are specified
in the hook object resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNcreateHook</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNchangeHook</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNconfigureHook</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNgeometryHook</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNdestroyHook</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr><tr><td align="left">XtNshells</td><td align="left">XtCReadOnly</td><td align="left">XtRWidgetList</td></tr><tr><td align="left">XtNnumShells</td><td align="left">XtCReadOnly</td><td align="left">XtRCardinal</td></tr></tbody></table></div><p>
</p><p>
Descriptions of each of these resources:
</p><p>
The XtNcreateHook callback list is called from:
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>,
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>,
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>,
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>,
and their corresponding varargs versions.
</p><p>
The <span class="emphasis"><em>call_data</em></span> parameter in a createHook callback may be
cast to type
<code class="function">XtCreateHookData</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
String type;<br />
Widget widget;<br />
ArgList args;<br />
Cardinal num_args;<br />
} XtCreateHookDataRec, *XtCreateHookData;<br />
</p></div><p>
The <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHcreate</code>,
<span class="emphasis"><em>widget</em></span> is the newly created widget, and <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span>
are the arguments passed to the create function. The callbacks are
called before returning from the create function.
</p><p>
The XtNchangeHook callback list is called from:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>,
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>,
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>,
<a class="xref" href="#XtUnmanageChild"><code class="function">XtUnmanageChild</code></a>,
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>,
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtAddCallback"><code class="function">XtAddCallback</code></a>,
<a class="xref" href="#XtRemoveCallback"><code class="function">XtRemoveCallback</code></a>,
<code class="function">XtAddCallbacks,</code>
<a class="xref" href="#XtRemoveCallbacks"><code class="function">XtRemoveCallbacks</code></a>,
<a class="xref" href="#XtRemoveAllCallbacks"><code class="function">XtRemoveAllCallbacks</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtAugmentTranslations"><code class="function">XtAugmentTranslations</code></a>,
<a class="xref" href="#XtOverrideTranslations"><code class="function">XtOverrideTranslations</code></a>,
<a class="xref" href="#XtUninstallTranslations"><code class="function">XtUninstallTranslations</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>,
<a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>,
<a class="xref" href="#XtMapWidget"><code class="function">XtMapWidget</code></a>,
<a class="xref" href="#XtUnmapWidget"><code class="function">XtUnmapWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>,
<a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>,
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>
</p></li></ul></div><p>
The <span class="emphasis"><em>call_data</em></span> parameter in a changeHook callback may
be cast to type
<code class="function">XtChangeHookData</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
String type;<br />
Widget widget;<br />
XtPointer event_data;<br />
Cardinal num_event_data;<br />
} XtChangeHookDataRec, *XtChangeHookData;<br />
</p></div><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
or
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>,
<span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHsetValues</code>,
<span class="emphasis"><em>widget</em></span> is the new widget passed to the set_values procedure, and
<span class="emphasis"><em>event_data</em></span> may be cast to type
<code class="function">XtChangeHookSetValuesData</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
Widget old, req;<br />
ArgList args;<br />
Cardinal num_args;<br />
} XtChangeHookSetValuesDataRec, *XtChangeHookSetValuesData;<br />
</p></div><p>
The <span class="emphasis"><em>old</em></span>, <span class="emphasis"><em>req</em></span>, <span class="emphasis"><em>args</em></span>, and <span class="emphasis"><em>num_args</em></span> are the
parameters passed to the set_values procedure. The callbacks are called
after the set_values and constraint set_values procedures have been called.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>
or
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>,
<span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHmanageChildren</code>,
<span class="emphasis"><em>widget</em></span> is the parent, <span class="emphasis"><em>event_data</em></span> may be cast to type
WidgetList and is the list of children being managed, and
<span class="emphasis"><em>num_event_data</em></span> is the length of the widget list.
The callbacks are called after the children have been managed.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtUnmanageChild"><code class="function">XtUnmanageChild</code></a>
or
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>,
<span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHunmanageChildren</code>,
<span class="emphasis"><em>widget</em></span> is the parent, <span class="emphasis"><em>event_data</em></span> may be cast to type
WidgetList and is a list of the children being unmanaged, and
<span class="emphasis"><em>num_event_data</em></span> is the length of the widget list.
The callbacks are called after the children have been unmanaged.
</p><p>
The changeHook callbacks are called twice as a result of a call to
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>,
once after unmanaging and again after managing.
When the callbacks are called the first time, <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHunmanageSet</code>,
<span class="emphasis"><em>widget</em></span> is the parent, <span class="emphasis"><em>event_data</em></span> may be cast to type
WidgetList and is a list of the children being unmanaged, and
<span class="emphasis"><em>num_event_data</em></span> is the length of the widget list.
When the callbacks are called the second time, the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHmanageSet</code>,
<span class="emphasis"><em>widget</em></span> is the parent, <span class="emphasis"><em>event_data</em></span> may be cast to type
WidgetList and is a list of the children being managed, and
<span class="emphasis"><em>num_event_data</em></span> is the length of the widget list.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHrealizeWidget</code>
and <span class="emphasis"><em>widget</em></span> is the widget being realized.
The callbacks are called after the widget has been realized.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHunrealizeWidget</code>,
and <span class="emphasis"><em>widget</em></span> is the widget being unrealized.
The callbacks are called after the widget has been unrealized.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtAddCallback"><code class="function">XtAddCallback</code></a>,
<span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHaddCallback</code>,
<span class="emphasis"><em>widget</em></span> is the widget to which the callback is being added, and
<span class="emphasis"><em>event_data</em></span> may be cast to type String and is the name of the
callback being added.
The callbacks are called after the callback has been added to the widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtAddCallbacks"><code class="function">XtAddCallbacks</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHaddCallbacks</code>,
<span class="emphasis"><em>widget</em></span> is the widget to which the callbacks are being added, and
<span class="emphasis"><em>event_data</em></span> may be cast to type String and is the name of the
callbacks being added.
The callbacks are called after the callbacks have been added to the widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtRemoveCallback"><code class="function">XtRemoveCallback</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHremoveCallback</code>,
<span class="emphasis"><em>widget</em></span> is the widget from which the callback is being removed, and
<span class="emphasis"><em>event_data</em></span> may be cast to type String and is the name of
the callback being removed. The callbacks are called after the callback
has been removed from the widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtRemoveCallbacks"><code class="function">XtRemoveCallbacks</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHremoveCallbacks</code>,
<span class="emphasis"><em>widget</em></span> is the widget from which the callbacks are being removed, and
<span class="emphasis"><em>event_data</em></span> may be cast to type String and is the name of the
callbacks being removed. The callbacks are called after the callbacks
have been removed from the widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtRemoveAllCallbacks"><code class="function">XtRemoveAllCallbacks</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHremoveAllCallbacks</code>
and <span class="emphasis"><em>widget</em></span> is the widget from which the callbacks are being removed.
The callbacks are called after the callbacks have been removed from the
widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtAugmentTranslations"><code class="function">XtAugmentTranslations</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHaugmentTranslations</code>
and <span class="emphasis"><em>widget</em></span> is the widget whose translations are being modified.
The callbacks are called after the widget's translations have been
modified.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtOverrideTranslations"><code class="function">XtOverrideTranslations</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHoverrideTranslations</code>
and <span class="emphasis"><em>widget</em></span> is the widget whose translations are being modified.
The callbacks are called after the widget's translations have been
modified.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtUninstallTranslations"><code class="function">XtUninstallTranslations</code></a>,
The <span class="emphasis"><em>type</em></span> is
<code class="function">XtHuninstallTranslations</code>
and <span class="emphasis"><em>widget</em></span> is the widget whose translations are being uninstalled.
The callbacks are called after the widget's translations have been
uninstalled.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHsetKeyboardFocus</code>
and <span class="emphasis"><em>event_data</em></span> may be cast to type Widget and is the value of
the descendant argument passed to <a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>. The
callbacks are called before returning from <a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>,
<span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHsetWMColormapWindows</code>,
<span class="emphasis"><em>event_data</em></span> may be cast to type WidgetList and is the value of
the list argument passed to <a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>, and
<span class="emphasis"><em>num_event_data</em></span> is the length of the list. The callbacks are
called before returning from <a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHsetMappedWhenManaged</code>
and <span class="emphasis"><em>event_data</em></span> may be cast to type Boolean and is the value of
the mapped_when_managed argument passed to <a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>.
The callbacks are called after setting the widget's mapped_when_managed
field and before realizing or unrealizing the widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtMapWidget"><code class="function">XtMapWidget</code></a>,
the <span class="emphasis"><em>type </em></span> is set to
<code class="function">XtHmapWidget</code>
and <span class="emphasis"><em>widget</em></span> is the widget being mapped.
The callbacks are called after mapping the widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtUnmapWidget"><code class="function">XtUnmapWidget</code></a>,
the <span class="emphasis"><em>type </em></span> is set to
<code class="function">XtHunmapWidget</code>
and <span class="emphasis"><em>widget</em></span> is the widget being unmapped.
The callbacks are called after unmapping the widget.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHpopup</code>,
<span class="emphasis"><em>widget</em></span> is the widget being popped up, and <span class="emphasis"><em>event_data</em></span> may
be cast to type XtGrabKind and is the value of the grab_kind argument
passed to <a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>.
The callbacks are called before returning from <a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHpopupSpringLoaded</code>
and <span class="emphasis"><em>widget</em></span> is the widget being popped up.
The callbacks are called
before returning from <a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>.
</p><p>
When the changeHook callbacks are called as a result of a call to
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>,
the <span class="emphasis"><em>type</em></span> is set to
<code class="function">XtHpopdown</code>
and <span class="emphasis"><em>widget</em></span> is the widget being popped down.
The callbacks are called
before returning from <a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>.
</p><p>
A widget set that exports interfaces that change application state
without employing the Intrinsics library should invoke the change hook
itself. This is done by:
</p><div class="literallayout"><p><br />
XtCallCallbacks(XtHooksOfDisplay(dpy), XtNchangeHook, call_data);<br />
</p></div><p>
The XtNconfigureHook callback list is called any time the Intrinsics
move, resize, or configure a widget and when
<a class="xref" href="#XtResizeWindow"><code class="function">XtResizeWindow</code></a>
is called.
</p><p>
The <span class="emphasis"><em>call_data</em></span> parameter may be cast to type
<code class="function">XtConfigureHookData.</code>
</p><div class="literallayout"><p><br />
typedef struct {<br />
String type;<br />
Widget widget;<br />
XtGeometryMask changeMask;<br />
XWindowChanges changes;<br />
} XtConfigureHookDataRec, *XtConfigureHookData;<br />
</p></div><p>
When the configureHook callbacks are called, the <span class="emphasis"><em>type</em></span> is
<code class="function">XtHconfigure</code>,
<span class="emphasis"><em>widget</em></span> is the widget being configured, and <span class="emphasis"><em>changeMask</em></span> and
<span class="emphasis"><em>changes</em></span> reflect the changes made to the widget. The callbacks
are called after changes have been made to the widget.
</p><p>
The XtNgeometryHook callback list is called from
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
and
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>
once before and once after geometry negotiation occurs.
</p><p>
The <span class="emphasis"><em>call_data</em></span> parameter may be cast to type
<code class="function">XtGeometryHookData</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
String type;<br />
Widget widget;<br />
XtWidgetGeometry* request;<br />
XtWidgetGeometry* reply;<br />
XtGeometryResult result;<br />
} XtGeometryHookDataRec, *XtGeometryHookData;<br />
</p></div><p>
When the geometryHook callbacks are called prior to geometry negotiation,
the <span class="emphasis"><em>type</em></span> is
<code class="function">XtHpreGeometry</code>,
<span class="emphasis"><em>widget</em></span> is the widget for which the request is being made, and
<span class="emphasis"><em>request</em></span> is the requested geometry.
When the geometryHook callbacks
are called after geometry negotiation, the <span class="emphasis"><em>type</em></span> is
<code class="function">XtHpostGeometry</code>,
<span class="emphasis"><em>widget</em></span> is the widget for which the request was made, <span class="emphasis"><em>request</em></span>
is the requested geometry, <span class="emphasis"><em>reply</em></span> is the resulting geometry granted,
and <span class="emphasis"><em>result</em></span> is the value returned from the geometry negotiation.
</p><p>
The XtNdestroyHook callback list is called when a widget is destroyed.
The <span class="emphasis"><em>call_data parameter</em></span> may be cast to type
<code class="function">XtDestroyHookData</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
String type;<br />
Widget widget;<br />
} XtDestroyHookDataRec, *XtDestroyHookData;<br />
</p></div><p>
When the destroyHook callbacks are called as a result of a call to
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>,
the <span class="emphasis"><em>type</em></span> is
<code class="function">XtHdestroy</code>
and <span class="emphasis"><em>widget</em></span> is the widget being destroyed. The callbacks are
called upon completion of phase one destroy for a widget.
</p><p>
The XtNshells and XtnumShells are read-only resources that report a
list of all parentless shell widgets associated with a display.
</p><p>
Clients who use these hooks must exercise caution in calling Intrinsics
functions in order to avoid recursion.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Querying_Open_Displays"></a>Querying Open Displays</h3></div></div></div><p>
To retrieve a list of the Displays associated with an application context,
use
<a class="xref" href="#XtGetDisplays"><code class="function">XtGetDisplays</code></a>.
</p><div class="funcsynopsis"><a id="XtGetDisplays"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetDisplays</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, Display ***<var class="pdparam">dpy_return</var>, Cardinal *<var class="pdparam">num_dpy_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>dpy_return</em></span>
</span></p></td><td><p>
Returns a list of open Display connections in the specified application
context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_dpy_return</em></span>
</span></p></td><td><p>
Returns the count of open Display connections in <span class="emphasis"><em>dpy_return</em></span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtGetDisplays"><code class="function">XtGetDisplays</code></a> may be used by an external agent to query the
list of open displays that belong to an application context. To free
the list of displays, use
<a class="xref" href="#XtFree"><code class="function">XtFree</code></a>.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Nonwidget_Objects"></a>Chapter 12. Nonwidget Objects</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Data_Structures">Data Structures</a></span></dt><dt><span class="sect1"><a href="#Object_Objects">Object Objects</a></span></dt><dd><dl><dt><span class="sect2"><a href="#ObjectClassPart_Structure">ObjectClassPart Structure</a></span></dt><dt><span class="sect2"><a href="#ObjectPart_Structure">ObjectPart Structure</a></span></dt><dt><span class="sect2"><a href="#Object_Resources">Object Resources</a></span></dt><dt><span class="sect2"><a href="#ObjectPart_Default_Values">ObjectPart Default Values</a></span></dt><dt><span class="sect2"><a href="#Object_Arguments_to_xI_Routines">Object Arguments to Intrinsics Routines</a></span></dt><dt><span class="sect2"><a href="#Use_of_Objects">Use of Objects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Rectangle_Objects">Rectangle Objects</a></span></dt><dd><dl><dt><span class="sect2"><a href="#RectObjClassPart_Structure">RectObjClassPart Structure</a></span></dt><dt><span class="sect2"><a href="#RectObjPart_Structure">RectObjPart Structure</a></span></dt><dt><span class="sect2"><a href="#RectObj_Resources">RectObj Resources</a></span></dt><dt><span class="sect2"><a href="#RectObjPart_Default_Values">RectObjPart Default Values</a></span></dt><dt><span class="sect2"><a href="#Widget_Arguments_to_xI_Routines">Widget Arguments to Intrinsics Routines</a></span></dt><dt><span class="sect2"><a href="#Use_of_Rectangle_Objects">Use of Rectangle Objects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Undeclared_Class">Undeclared Class</a></span></dt><dt><span class="sect1"><a href="#Widget_Arguments_to_Intrinsics_Routines">Widget Arguments to Intrinsics Routines</a></span></dt></dl></div><p>
Although widget writers are free to treat
Core
as the base class of
the widget hierarchy, there are actually three classes above it.
These classes are
Object,
RectObj
(Rectangle Object), and (unnamed),
and members of these classes
are referred to generically as <span class="emphasis"><em>objects</em></span>. By convention, the term
<span class="emphasis"><em>widget</em></span> refers only to objects that are a subclass of
Core,
and the term <span class="emphasis"><em>nonwidget</em></span> refers to objects that are not a subclass of
Core.
In the preceding portion of this specification, the interface
descriptions indicate explicitly whether the generic <span class="emphasis"><em>widget</em></span> argument
is restricted to particular subclasses of Object. Sections 12.2.5,
12.3.5, and 12.5 summarize the permissible classes of the arguments to, and
return values from, each of the Intrinsics routines.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Data_Structures"></a>Data Structures</h2></div></div></div><p>
In order not to conflict with previous widget code, the data
structures used by nonwidget objects do not follow all the same
conventions as those for widgets. In particular, the class records
are not composed of parts but instead are complete data structures
with filler for the widget fields they do not use. This
allows the static class initializers for existing widgets to remain
unchanged.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Object_Objects"></a>Object Objects</h2></div></div></div><p>
The
Object
object contains the definitions of fields common to all
objects. It encapsulates the mechanisms for resource management.
All objects and widgets are members of subclasses of
Object,
which is defined by the
<code class="function">ObjectClassPart</code>
and
<code class="function">ObjectPart</code>
structures.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ObjectClassPart_Structure"></a>ObjectClassPart Structure</h3></div></div></div><p>
The common fields for all object classes are defined in the
<code class="function">ObjectClassPart</code>
structure. All fields have the same purpose,
function, and restrictions as the corresponding fields in
<code class="function">CoreClassPart</code>;
fields whose
names are obj<span class="emphasis"><em>n</em></span> for some integer <span class="emphasis"><em>n</em></span> are not
used for Object,
but exist to pad the data structure so that it matches Core's class
record. The class record initialization must fill all
obj<span class="emphasis"><em>n</em></span> fields with NULL or zero as appropriate to the type.
</p><div class="literallayout"><p><br />
typedef struct _ObjectClassPart {<br />
WidgetClass superclass;<br />
String class_name;<br />
Cardinal widget_size;<br />
XtProc class_initialize;<br />
XtWidgetClassProc class_part_initialize;<br />
XtEnum class_inited;<br />
XtInitProc initialize;<br />
XtArgsProc initialize_hook;<br />
XtProc obj1;<br />
XtPointer obj2;<br />
Cardinal obj3;<br />
XtResourceList resources;<br />
Cardinal num_resources;<br />
XrmClass xrm_class;<br />
Boolean obj4;<br />
XtEnum obj5;<br />
Boolean obj6;<br />
Boolean obj7;<br />
XtWidgetProc destroy;<br />
XtProc obj8;<br />
XtProc obj9;<br />
XtSetValuesFunc set_values;<br />
XtArgsFunc set_values_hook;<br />
XtProc obj10;<br />
XtArgsProc get_values_hook;<br />
XtProc obj11;<br />
XtVersionType version;<br />
XtPointer callback_private;<br />
String obj12;<br />
XtProc obj13;<br />
XtProc obj14;<br />
XtPointer extension;<br />
} ObjectClassPart;<br />
</p></div><p>
The extension record defined for
<code class="function">ObjectClassPart</code>
with a <span class="emphasis"><em>record_type</em></span> equal to
<span class="strong"><strong>NULLQUARK</strong></span>
is
<code class="function">ObjectClassExtensionRec</code>.
</p><div class="literallayout"><p><br />
typedef struct {<br />
XtPointer next_extension; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
XrmQuark record_type; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
long version; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
Cardinal record_size; See <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a><br />
XtAllocateProc allocate; See <a class="xref" href="#Widget_Instance_Allocation_The_allocate_Procedure" title="Widget Instance Allocation: The allocate Procedure">the section called “Widget Instance Allocation: The allocate Procedure”</a>.<br />
XtDeallocateProc deallocate; See <a class="xref" href="#Widget_Instance_Deallocation_The_deallocate_Procedure" title="Widget Instance Deallocation: The deallocate Procedure">the section called “Widget Instance Deallocation: The deallocate Procedure”</a>.<br />
} ObjectClassExtensionRec, *ObjectClassExtension;<br />
</p></div><p>
The prototypical
<code class="function">ObjectClass</code>
consists of just the
<code class="function">ObjectClassPart</code>.
</p><div class="literallayout"><p><br />
typedef struct _ObjectClassRec {<br />
ObjectClassPart object_class;<br />
} ObjectClassRec, *ObjectClass;<br />
</p></div><p>
The predefined class record and pointer for
<code class="function">ObjectClassRec</code>
are
</p><p>
In
<code class="function">IntrinsicP.h</code>:
</p><div class="literallayout"><p><br />
extern ObjectClassRec objectClassRec;<br />
</p></div><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
extern WidgetClass objectClass;<br />
</p></div><p>
The opaque types
<code class="function">Object</code>
and
<code class="function">ObjectClass</code>
and the opaque variable
<code class="function">objectClass</code>
are defined for generic actions on objects.
The symbolic constant for the
<code class="function">ObjectClassExtension</code>
version identifier is
<code class="function">XtObjectExtensionVersion</code>
(see <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a>).
<code class="function">Intrinsic.h</code>
uses an incomplete structure definition to ensure that the
compiler catches attempts to access private data:
</p><div class="literallayout"><p><br />
typedef struct _ObjectClassRec* ObjectClass;<br />
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ObjectPart_Structure"></a>ObjectPart Structure</h3></div></div></div><p>
The common fields for all object instances are defined in the
<code class="function">ObjectPart</code>
structure. All fields have the same meaning as the
corresponding fields in
<code class="function">CorePart</code>.
</p><div class="literallayout"><p><br />
typedef struct _ObjectPart {<br />
Widget self;<br />
WidgetClass widget_class;<br />
Widget parent;<br />
Boolean being_destroyed;<br />
XtCallbackList destroy_callbacks;<br />
XtPointer constraints;<br />
} ObjectPart;<br />
</p></div><p>
All object instances have the
Object
fields as their first component. The prototypical type
<code class="function">Object</code>
is defined with only this set of fields.
Various routines can cast object pointers, as needed, to specific
object types.
</p><p>
In
<code class="function">IntrinsicP.h</code>:
</p><div class="literallayout"><p><br />
typedef struct _ObjectRec {<br />
ObjectPart object;<br />
} ObjectRec, *Object;<br />
</p></div><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
typedef struct _ObjectRec *Object;<br />
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Object_Resources"></a>Object Resources</h3></div></div></div><p>
The resource names, classes, and representation types specified in the
<code class="function">objectClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNdestroyCallback</td><td align="left">XtCCallback</td><td align="left">XtRCallback</td></tr></tbody></table></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="ObjectPart_Default_Values"></a>ObjectPart Default Values</h3></div></div></div><p>
All fields in
<code class="function">ObjectPart</code>
have the same default values as the corresponding fields in
<code class="function">CorePart</code>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Object_Arguments_to_xI_Routines"></a>Object Arguments to Intrinsics Routines</h3></div></div></div><p>
The WidgetClass arguments to the following procedures may be
<code class="function">objectClass</code>
or any subclass:
</p><p>
<span class="strong"><strong>XtInitializeWidgetClass</strong></span>,
<span class="strong"><strong>XtCreateWidget</strong></span>,
<span class="strong"><strong>XtVaCreateWidget</strong></span>
<span class="strong"><strong>XtIsSubclass</strong></span>,
<span class="strong"><strong>XtCheckSubclass</strong></span>
<span class="strong"><strong>XtGetResourceList</strong></span>,
<span class="strong"><strong>XtGetConstraintResourceList</strong></span>
</p><p>
The Widget arguments to the following procedures may be of class
Object
or any subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>,
<a class="xref" href="#XtVaCreateWidget"><code class="function">XtVaCreateWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtAddCallback"><code class="function">XtAddCallback</code></a>,
<a class="xref" href="#XtAddCallbacks"><code class="function">XtAddCallbacks</code></a>,
<a class="xref" href="#XtRemoveCallback"><code class="function">XtRemoveCallback</code></a>,
<a class="xref" href="#XtRemoveCallbacks"><code class="function">XtRemoveCallbacks</code></a>,
<a class="xref" href="#XtRemoveAllCallbacks"><code class="function">XtRemoveAllCallbacks</code></a>,
<a class="xref" href="#XtCallCallbacks"><code class="function">XtCallCallbacks</code></a>,
<a class="xref" href="#XtHasCallbacks"><code class="function">XtHasCallbacks</code></a>,
<a class="xref" href="#XtCallCallbackList"><code class="function">XtCallCallbackList</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtClass"><code class="function">XtClass</code></a>,
<code class="function">XtSuperclass</code>,
<a class="xref" href="#XtIsSubclass"><code class="function">XtIsSubclass</code></a>,
<a class="xref" href="#XtCheckSubclass"><code class="function">XtCheckSubclass</code></a>,
<code class="function">XtIsObject</code>,
<code class="function">XtIsRectObj</code>,
<code class="function">XtIsWidget</code>,
<code class="function">XtIsComposite</code>,
<code class="function">XtIsConstraint</code>,
<code class="function">XtIsShell</code>,
<code class="function">XtIsOverrideShell</code>,
<code class="function">XtIsWMShell</code>,
<code class="function">XtIsVendorShell</code>,
<code class="function">XtIsTransientShell</code>,
<code class="function">XtIsToplevelShell</code>,
<code class="function">XtIsApplicationShell</code>,
<code class="function">XtIsSessionShell</code>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtIsManaged"><code class="function">XtIsManaged</code></a>,
<a class="xref" href="#XtIsSensitive"><code class="function">XtIsSensitive</code></a>
(both will return
<code class="function">False</code>
if argument is not a subclass of
RectObj)
</p></li><li class="listitem"><p>
<a class="xref" href="#XtIsRealized"><code class="function">XtIsRealized</code></a>
(returns the state of the nearest windowed ancestor
if class of argument is not a subclass of
Core)
</p></li><li class="listitem"><p>
<a class="xref" href="#XtWidgetToApplicationContext"><code class="function">XtWidgetToApplicationContext</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtDestroyWidget"><code class="function">XtDestroyWidget</code></a>
</p></li><li class="listitem"><p>
<code class="function">XtParent</code>,
<a class="xref" href="#XtDisplayOfObject"><code class="function">*XtDisplayOfObject</code></a>,
<a class="xref" href="#XtScreenOfObject"><code class="function">*XtScreenOfObject</code></a>,
<a class="xref" href="#XtWindowOfObject"><code class="function">XtWindowOfObject</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>
(descendant)
</p></li><li class="listitem"><p>
<a class="xref" href="#XtGetGC"><code class="function">XtGetGC</code></a>,
<a class="xref" href="#XtReleaseGC"><code class="function">XtReleaseGC</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtName"><code class="function">XtName</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>,
<a class="xref" href="#XtGetValues"><code class="function">XtGetValues</code></a>,
<a class="xref" href="#XtVaSetValues"><code class="function">XtVaSetValues</code></a>,
<a class="xref" href="#XtVaGetValues"><code class="function">XtVaGetValues</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtGetSubresources"><code class="function">XtGetSubresources</code></a>,
<a class="xref" href="#XtGetApplicationResources"><code class="function">XtGetApplicationResources</code></a>,
<a class="xref" href="#XtVaGetSubresources"><code class="function">XtVaGetSubresources</code></a>,
<a class="xref" href="#XtVaGetApplicationResources"><code class="function">XtVaGetApplicationResources</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtConvert"><code class="function">XtConvert</code></a>,
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>
</p></li></ul></div><p>
The return value of the following procedures will be of class
Object
or a subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>,
<a class="xref" href="#XtVaCreateWidget"><code class="function">XtVaCreateWidget</code></a>
</p></li><li class="listitem"><p>
<code class="function">XtParent</code>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtNameToWidget"><code class="function">XtNameToWidget</code></a>
</p></li></ul></div><p>
The return value of the following procedures will be
<code class="function">objectClass</code>
or a subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtClass"><code class="function">XtClass</code></a>,
<code class="function">XtSuperclass</code>
</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Use_of_Objects"></a>Use of Objects</h3></div></div></div><p>
The
Object
class exists to enable programmers to use the Intrinsics'
classing and resource-handling mechanisms for things smaller
and simpler than widgets.
Objects make obsolete many common uses of subresources as described in
Sections 9.4, 9.7.2.4, and 9.7.2.5.
</p><p>
Composite
widget classes that wish to accept nonwidget children must
set the <span class="emphasis"><em>accepts_objects</em></span> field in the
<code class="function">CompositeClassExtension</code>
structure to
<code class="function">True</code>.
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
will otherwise generate an error message on an attempt to create a
nonwidget child.
</p><p>
Of the classes defined by the Intrinsics,
ApplicationShell
and
SessionShell
accept nonwidget children, and the class of any nonwidget child
must not be
<code class="function">rectObjClass</code>
or any subclass. The intent of allowing
Object
children of
ApplicationShell
and
SessionShell
is to provide clients a simple mechanism
for establishing the resource-naming root of an object hierarchy.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Rectangle_Objects"></a>Rectangle Objects</h2></div></div></div><p>
The class of rectangle objects is a subclass of
Object
that represents
rectangular areas. It encapsulates the mechanisms for geometry
management and is called RectObj
to avoid conflict with the Xlib
<code class="function">Rectangle</code>
data type.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="RectObjClassPart_Structure"></a>RectObjClassPart Structure</h3></div></div></div><p>
As with the
<code class="function">ObjectClassPart</code>
structure, all fields in the
<code class="function">RectObjClassPart</code>
structure have the same
purpose and function as the corresponding fields in
<code class="function">CoreClassPart</code>;
fields whose names are rect<span class="emphasis"><em>n</em></span> for some integer
<span class="emphasis"><em>n</em></span> are not used for
RectObj, but exist to pad the data structure so that it matches
Core's
class record. The class record initialization must fill all
rect<span class="emphasis"><em>n</em></span> fields with NULL or zero as appropriate to the type.
</p><div class="literallayout"><p><br />
typedef struct _RectObjClassPart {<br />
WidgetClass superclass;<br />
String class_name;<br />
Cardinal widget_size;<br />
XtProc class_initialize;<br />
XtWidgetClassProc class_part_initialize;<br />
XtEnum class_inited;<br />
XtInitProc initialize;<br />
XtArgsProc initialize_hook;<br />
XtProc rect1;<br />
XtPointer rect2;<br />
Cardinal rect3;<br />
XtResourceList resources;<br />
Cardinal num_resources;<br />
XrmClass xrm_class;<br />
Boolean rect4;<br />
XtEnum rect5;<br />
Boolean rect6;<br />
Boolean rect7;<br />
XtWidgetProc destroy;<br />
XtWidgetProc resize;<br />
XtExposeProc expose;<br />
XtSetValuesFunc set_values;<br />
XtArgsFunc set_values_hook;<br />
XtAlmostProc set_values_almost;<br />
XtArgsProc get_values_hook;<br />
XtProc rect9;<br />
XtVersionType version;<br />
XtPointer callback_private;<br />
String rect10;<br />
XtGeometryHandler query_geometry;<br />
XtProc rect11;<br />
XtPointer extension ;<br />
} RectObjClassPart;<br />
</p></div><p>
The
RectObj
class record consists of just the
<code class="function">RectObjClassPart</code>.
</p><div class="literallayout"><p><br />
typedef struct _RectObjClassRec {<br />
RectObjClassPart rect_class;<br />
} RectObjClassRec, *RectObjClass;<br />
</p></div><p>
The predefined class record and pointer for
<code class="function">RectObjClassRec</code>
are
</p><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
extern RectObjClassRec rectObjClassRec;<br />
</p></div><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
extern WidgetClass rectObjClass;<br />
</p></div><p>
The opaque types
<code class="function">RectObj</code>
and
<code class="function">RectObjClass</code>
and the opaque variable
<code class="function">rectObjClass</code>
are defined for generic actions on objects
whose class is RectObj or a subclass of
RectObj.
<code class="function">Intrinsic.h</code>
uses an incomplete structure definition to ensure that the compiler
catches attempts to access private data:
</p><div class="literallayout"><p><br />
typedef struct _RectObjClassRec* RectObjClass;<br />
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="RectObjPart_Structure"></a>RectObjPart Structure</h3></div></div></div><p>
In addition to the
<code class="function">ObjectPart</code>
fields,
RectObj
objects have the following fields defined in the
<code class="function">RectObjPart</code>
structure. All fields have the same meaning as the corresponding field in
<code class="function">CorePart</code>.
</p><div class="literallayout"><p><br />
typedef struct _RectObjPart {<br />
Position x, y;<br />
Dimension width, height;<br />
Dimension border_width;<br />
Boolean managed;<br />
Boolean sensitive;<br />
Boolean ancestor_sensitive;<br />
} RectObjPart;<br />
</p></div><p>
RectObj
objects have the RectObj fields immediately following the Object fields.
</p><div class="literallayout"><p><br />
typedef struct _RectObjRec {<br />
ObjectPart object;<br />
RectObjPart rectangle;<br />
} RectObjRec, *RectObj;<br />
</p></div><p>
In
<code class="function">Intrinsic.h</code>:
</p><div class="literallayout"><p><br />
typedef struct _RectObjRec* RectObj;<br />
</p></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="RectObj_Resources"></a>RectObj Resources</h3></div></div></div><p>
The resource names, classes, and representation types that are specified in the
<code class="function">rectObjClassRec</code>
resource list are:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Class</th><th align="left">Representation</th></tr></thead><tbody><tr><td align="left">XtNancestorSensitive</td><td align="left">XtCSensitive</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNborderWidth</td><td align="left">XtCBorderWidth</td><td align="left">XtRDimension</td></tr><tr><td align="left">XtNheight</td><td align="left">XtCHeight</td><td align="left">XtRDimension</td></tr><tr><td align="left">XtNsensitive</td><td align="left">XtCSensitive</td><td align="left">XtRBoolean</td></tr><tr><td align="left">XtNwidth</td><td align="left">XtCWidth</td><td align="left">XtRDimension</td></tr><tr><td align="left">XtNx</td><td align="left">XtCPosition</td><td align="left">XtRPosition</td></tr><tr><td align="left">XtNy</td><td align="left">XtCPosition</td><td align="left">XtRPosition</td></tr></tbody></table></div><p>
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="RectObjPart_Default_Values"></a>RectObjPart Default Values</h3></div></div></div><p>
All fields in
<code class="function">RectObjPart</code>
have the same default values as the corresponding fields in
<code class="function">CorePart</code>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Arguments_to_xI_Routines"></a>Widget Arguments to Intrinsics Routines</h3></div></div></div><p>
The WidgetClass arguments to the following procedures may be
<code class="function">rectObjClass</code>
or any subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>,
<a class="xref" href="#XtVaCreateManagedWidget"><code class="function">XtVaCreateManagedWidget</code></a>
</p></li></ul></div><p>
The Widget arguments to the following procedures may be of class
RectObj
or any subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>,
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>,
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>,
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>,
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>,
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>,
<a class="xref" href="#XtUnmanageChild"><code class="function">XtUnmanageChild</code></a>,
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetSensitive"><code class="function">XtSetSensitive</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtTranslateCoords"><code class="function">XtTranslateCoords</code></a>
</p></li></ul></div><p>
The return value of the following procedures will be of class
RectObj
or a subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>,
<a class="xref" href="#XtVaCreateManagedWidget"><code class="function">XtVaCreateManagedWidget</code></a>
</p></li></ul></div></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Use_of_Rectangle_Objects"></a>Use of Rectangle Objects</h3></div></div></div><p>
RectObj
can be subclassed to provide widgetlike objects (sometimes
called gadgets) that do not use windows and do not have those
features that are seldom used in simple widgets. This can save memory
resources both in the server and in applications
but requires additional support code in the parent.
In the following
discussion, <span class="emphasis"><em>rectobj</em></span> refers only to objects
whose class is RectObj or a subclass of
RectObj,
but not Core or a subclass of
Core.
</p><p>
Composite
widget classes that wish to accept rectobj children must set
the <span class="emphasis"><em>accepts_objects</em></span> field in the
<code class="function">CompositeClassExtension</code>
extension structure to
<code class="function">True</code>.
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
or
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>
will otherwise generate an error if called to create a nonwidget child.
If the composite widget supports only children of class
RectObj
or a subclass (i.e., not of the general Object class), it
must declare an insert_child procedure and check the subclass of each
new child in that procedure. None of the classes defined by the
Intrinsics accept rectobj children.
</p><p>
If gadgets are defined in an object set, the parent is responsible for
much more than the parent of a widget. The parent must request and handle
input events that occur for the gadget and is responsible for making
sure that when it receives an exposure event the gadget children get
drawn correctly.
Rectobj children may
have expose procedures
specified in their class records, but the parent is free to
ignore them, instead drawing the contents of the child itself. This
can potentially save graphics context switching. The precise contents
of the exposure event and region arguments to the RectObj expose
procedure are not specified by the Intrinsics; a particular rectangle object is
free to define the coordinate system origin (self-relative or
parent-relative) and whether or not the rectangle or region is assumed to
have been intersected with the visible region of the object.
</p><p>
In general, it is expected that a composite widget that accepts
nonwidget children will document those children it is able to handle,
since a gadget cannot be viewed as a completely self-contained entity,
as can a widget. Since a particular composite widget class is usually
designed to handle nonwidget children of only a limited set of classes, it should
check the classes of newly added children in its insert_child
procedure to make sure that it can deal with them.
</p><p>
The Intrinsics will clear areas of a parent window obscured by
rectobj children, causing exposure events, under the following
circumstances:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
A rectobj child is managed or unmanaged.
</p></li><li class="listitem"><p>
In a call to
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>
on a rectobj child, one or more of the set_values procedures returns
<code class="function">True</code>.
</p></li><li class="listitem"><p>
In a call to
<a class="xref" href="#XtConfigureWidget"><code class="function">XtConfigureWidget</code></a>
on a rectobj child, areas will
be cleared corresponding to both the old and the new child
geometries, including the border, if the geometry changes.
</p></li><li class="listitem"><p>
In a call to
<a class="xref" href="#XtMoveWidget"><code class="function">XtMoveWidget</code></a>
on a rectobj child, areas will be
cleared corresponding to both the old and the new child
geometries, including the border, if the geometry changes.
</p></li><li class="listitem"><p>
In a call to
<a class="xref" href="#XtResizeWidget"><code class="function">XtResizeWidget</code></a>
on a rectobj child, a single
rectangle will be cleared corresponding to the larger of the
old and the new child geometries if they are different.
</p></li><li class="listitem"><p>
In a call to
<a class="xref" href="#XtMakeGeometryRequest"><code class="function">XtMakeGeometryRequest</code></a>
(or
<a class="xref" href="#XtMakeResizeRequest"><code class="function">XtMakeResizeRequest</code></a>)
on a rectobj child with
<code class="function">XtQueryOnly</code>
not set, if the manager returns
<code class="function">XtGeometryYes</code>,
two rectangles will be cleared corresponding to both the old and
the new child geometries.
</p></li></ul></div><p>
Stacking order is not supported for rectobj children. Composite widgets with
rectobj children are free to define any semantics desired if the child
geometries overlap, including making this an error.
</p><p>
When a rectobj is playing the role of a widget, developers must be
reminded to avoid making assumptions about the object passed in the
Widget argument to a callback procedure.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Undeclared_Class"></a>Undeclared Class</h2></div></div></div><p>
The Intrinsics define an unnamed class between
RectObj
and
Core
for possible future use by the X Consortium. The only assumptions that
may be made about the unnamed class are
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
The <span class="emphasis"><em>core_class.superclass</em></span> field of
<code class="function">coreWidgetClassRec</code>
contains a pointer to the unnamed class record.
</p></li><li class="listitem"><p>
A pointer to the unnamed class record when dereferenced as an
<code class="function">ObjectClass</code>
will contain a pointer to
<code class="function">rectObjClassRec</code>
in its <span class="emphasis"><em>object_class.superclass</em></span> field.
</p></li></ul></div><p>
Except for the above, the contents of the class record for this class
and the result of an attempt to subclass or to create a widget of this
unnamed class are undefined.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Widget_Arguments_to_Intrinsics_Routines"></a>Widget Arguments to Intrinsics Routines</h2></div></div></div><p>
The WidgetClass arguments to the following procedures must be of class
Shell
or a subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>,
<a class="xref" href="#XtVaCreatePopupShell"><code class="function">XtVaCreatePopupShell</code></a>,
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>,
<a class="xref" href="#XtVaAppCreateShell"><code class="function">XtVaAppCreateShell</code></a>,
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>,
<a class="xref" href="#XtVaOpenApplication"><code class="function">XtVaOpenApplication</code></a>
</p></li></ul></div><p>
The Widget arguments to the following procedures must be of class
Core
or any subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>,
<a class="xref" href="#XtVaCreatePopupShell"><code class="function">XtVaCreatePopupShell</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtAddEventHandler"><code class="function">XtAddEventHandler</code></a>,
<a class="xref" href="#XtAddRawEventHandler"><code class="function">XtAddRawEventHandler</code></a>,
<a class="xref" href="#XtRemoveEventHandler"><code class="function">XtRemoveEventHandler</code></a>,
<a class="xref" href="#XtRemoveRawEventHandler"><code class="function">XtRemoveRawEventHandler</code></a>,
<a class="xref" href="#XtInsertEventHandler"><code class="function">XtInsertEventHandler</code></a>,
<a class="xref" href="#XtInsertRawEventHandler"><code class="function">XtInsertRawEventHandler</code></a>
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>,
<a class="xref" href="#XtRemoveEventTypeHandler"><code class="function">XtRemoveEventTypeHandler</code></a>,
</p></li><li class="listitem"><p>
<a class="xref" href="#XtRegisterDrawable"><code class="function">XtRegisterDrawable</code></a>
<a class="xref" href="#XtDispatchEventToWidget"><code class="function">XtDispatchEventToWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtAddGrab"><code class="function">XtAddGrab</code></a>,
<a class="xref" href="#XtRemoveGrab"><code class="function">XtRemoveGrab</code></a>,
<a class="xref" href="#XtGrabKey"><code class="function">XtGrabKey</code></a>,
<a class="xref" href="#XtGrabKeyboard"><code class="function">XtGrabKeyboard</code></a>,
<a class="xref" href="#XtUngrabKey"><code class="function">XtUngrabKey</code></a>,
<a class="xref" href="#XtUngrabKeyboard"><code class="function">XtUngrabKeyboard</code></a>,
<a class="xref" href="#XtGrabButton"><code class="function">XtGrabButton</code></a>,
<a class="xref" href="#XtGrabPointer"><code class="function">XtGrabPointer</code></a>,
<a class="xref" href="#XtUngrabButton"><code class="function">XtUngrabButton</code></a>,
<a class="xref" href="#XtUngrabPointer"><code class="function">XtUngrabPointer</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtBuildEventMask"><code class="function">XtBuildEventMask</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtCreateWindow"><code class="function">XtCreateWindow</code></a>,
<code class="function">XtDisplay</code>,
<a class="xref" href="#XtScreen"><code class="function">*XtScreen</code></a>,
<a class="xref" href="#XtWindow"><code class="function">XtWindow</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtNameToWidget"><code class="function">XtNameToWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtGetSelectionValue"><code class="function">XtGetSelectionValue</code></a>,
<a class="xref" href="#XtGetSelectionValues"><code class="function">XtGetSelectionValues</code></a>,
<a class="xref" href="#XtOwnSelection"><code class="function">XtOwnSelection</code></a>,
<a class="xref" href="#XtDisownSelection"><code class="function">XtDisownSelection</code></a>,
<a class="xref" href="#XtOwnSelectionIncremental"><code class="function">XtOwnSelectionIncremental</code></a>,
<a class="xref" href="#XtGetSelectionValueIncremental"><code class="function">XtGetSelectionValueIncremental</code></a>,
<a class="xref" href="#XtGetSelectionValuesIncremental"><code class="function">XtGetSelectionValuesIncremental</code></a>,
<a class="xref" href="#XtGetSelectionRequest"><code class="function">XtGetSelectionRequest</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtInstallAccelerators"><code class="function">XtInstallAccelerators</code></a>,
<a class="xref" href="#XtInstallAllAccelerators"><code class="function">XtInstallAllAccelerators</code></a>
(both destination and source)
</p></li><li class="listitem"><p>
<a class="xref" href="#XtAugmentTranslations"><code class="function">XtAugmentTranslations</code></a>,
<a class="xref" href="#XtOverrideTranslations"><code class="function">XtOverrideTranslations</code></a>,
<a class="xref" href="#XtUninstallTranslations"><code class="function">XtUninstallTranslations</code></a>,
<a class="xref" href="#XtCallActionProc"><code class="function">XtCallActionProc</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtMapWidget"><code class="function">XtMapWidget</code></a>,
<a class="xref" href="#XtUnmapWidget"><code class="function">XtUnmapWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtRealizeWidget"><code class="function">XtRealizeWidget</code></a>,
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetMappedWhenManaged"><code class="function">XtSetMappedWhenManaged</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtCallAcceptFocus"><code class="function">XtCallAcceptFocus</code></a>,
<a class="xref" href="#XtSetKeyboardFocus"><code class="function">XtSetKeyboardFocus</code></a>
(subtree)
</p></li><li class="listitem"><p>
<a class="xref" href="#XtResizeWindow"><code class="function">XtResizeWindow</code></a>
</p></li><li class="listitem"><p>
<a class="xref" href="#XtSetWMColormapWindows"><code class="function">XtSetWMColormapWindows</code></a>
</p></li></ul></div><p>
The Widget arguments to the following procedures must be of class
Composite
or any subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtCreateManagedWidget"><code class="function">XtCreateManagedWidget</code></a>,
<a class="xref" href="#XtVaCreateManagedWidget"><code class="function">XtVaCreateManagedWidget</code></a>
</p></li></ul></div><p>
The Widget arguments to the following procedures must be of a subclass of
Shell:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtPopdown"><code class="function">XtPopdown</code></a>,
<a class="xref" href="#XtCallbackPopdown"><code class="function">XtCallbackPopdown</code></a>,
<a class="xref" href="#XtPopup"><code class="function">XtPopup</code></a>,
<a class="xref" href="#XtCallbackNone"><code class="function">XtCallbackNone</code></a>,
<a class="xref" href="#XtCallbackNonexclusive"><code class="function">XtCallbackNonexclusive</code></a>,
<a class="xref" href="#XtCallbackExclusive"><code class="function">XtCallbackExclusive</code></a>,
<a class="xref" href="#XtPopupSpringLoaded"><code class="function">XtPopupSpringLoaded</code></a>
</p></li></ul></div><p>
The return value of the following procedure will be of class
Core
or a subclass:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtWindowToWidget"><code class="function">XtWindowToWidget</code></a>
</p></li></ul></div><p>
The return value of the following procedures will be of a subclass of
Shell:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>,
<a class="xref" href="#XtVaAppCreateShell"><code class="function">XtVaAppCreateShell</code></a>,
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>,
<a class="xref" href="#XtVaAppInitialize"><code class="function">XtVaAppInitialize</code></a>,
<a class="xref" href="#XtCreatePopupShell"><code class="function">XtCreatePopupShell</code></a>,
<a class="xref" href="#XtVaCreatePopupShell"><code class="function">XtVaCreatePopupShell</code></a>
</p></li></ul></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="Evolution_of_the_Intrinsics"></a>Chapter 13. Evolution of the Intrinsics</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="#Determining_Specification_Revision_Level">Determining Specification Revision Level</a></span></dt><dt><span class="sect1"><a href="#Release_to_Release_Compatibility">Release 3 to Release 4 Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Additional_Arguments">Additional Arguments</a></span></dt><dt><span class="sect2"><a href="#set_values_almost_Procedures">set_values_almost Procedures</a></span></dt><dt><span class="sect2"><a href="#Query_Geometry">Query Geometry</a></span></dt><dt><span class="sect2"><a href="#unrealizeCallback_Callback_List">unrealizeCallback Callback List</a></span></dt><dt><span class="sect2"><a href="#Subclasses_of_WMShell">Subclasses of WMShell</a></span></dt><dt><span class="sect2"><a href="#Resource_Type_Converters">Resource Type Converters</a></span></dt><dt><span class="sect2"><a href="#KeySym_Case_Conversion_Procedure">KeySym Case Conversion Procedure</a></span></dt><dt><span class="sect2"><a href="#Nonwidget_Objects_2">Nonwidget Objects</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Release_to_Release_Compatibility_2">Release 4 to Release 5 Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#baseTranslations_Resource">baseTranslations Resource</a></span></dt><dt><span class="sect2"><a href="#Resource_File_Search_Path">Resource File Search Path</a></span></dt><dt><span class="sect2"><a href="#Customization_Resource">Customization Resource</a></span></dt><dt><span class="sect2"><a href="#Per_Screen_Resource_Database">Per-Screen Resource Database</a></span></dt><dt><span class="sect2"><a href="#Internationalization_of_Applications">Internationalization of Applications</a></span></dt><dt><span class="sect2"><a href="#Permanently_Allocated_Strings">Permanently Allocated Strings</a></span></dt><dt><span class="sect2"><a href="#Arguments_to_Existing_Functions">Arguments to Existing Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#Release_to_Release_Compatibility_3">Release 5 to Release 6 Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="#Widget_Internals">Widget Internals</a></span></dt><dt><span class="sect2"><a href="#General_Application_Development">General Application Development</a></span></dt><dt><span class="sect2"><a href="#Communication_with_Window_and_Session_Managers">Communication with Window and Session Managers</a></span></dt><dt><span class="sect2"><a href="#Geometry_Management_2">Geometry Management</a></span></dt><dt><span class="sect2"><a href="#Event_Management_2">Event Management</a></span></dt><dt><span class="sect2"><a href="#Resource_Management_2">Resource Management</a></span></dt><dt><span class="sect2"><a href="#Translation_Management_2">Translation Management</a></span></dt><dt><span class="sect2"><a href="#Selections">Selections</a></span></dt><dt><span class="sect2"><a href="#External_Agent_Hooks">External Agent Hooks</a></span></dt></dl></dd></dl></div><p>
The interfaces described by this specification have undergone several
sets of revisions in the course of adoption as an X Consortium
standard specification. Having now been adopted by the Consortium as
a standard part of the X Window System, it is expected that this and
future revisions will retain
backward compatibility in the sense that fully conforming
implementations of these specifications may be produced that provide
source compatibility with widgets and applications written to
previous Consortium standard revisions.
</p><p>
The Intrinsics do not place any special requirement on widget
programmers to retain source or binary compatibility for their widgets
as they evolve, but several conventions have been established to
assist those developers who want to provide such compatibility.
</p><p>
In particular, widget programmers may wish to conform to the convention
described in <a class="xref" href="#Class_Extension_Records" title="Class Extension Records">the section called “Class Extension Records”</a> when defining class extension records.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Determining_Specification_Revision_Level"></a>Determining Specification Revision Level</h2></div></div></div><p>
Widget and application developers who wish to maintain a common source
pool that will build properly with implementations of the Intrinsics
at different revision levels of these specifications but that take
advantage of newer features added in later revisions may use the
symbolic macro
<code class="function">XtSpecificationRelease</code>.
</p><div class="literallayout"><p><br />
#define XtSpecificationRelease 6<br />
</p></div><p>
As the symbol
<code class="function">XtSpecificationRelease</code>
was new to Release 4, widgets and
applications desiring to build against earlier implementations should
test for the presence of this symbol and assume only Release 3
interfaces if the definition is not present.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Release_to_Release_Compatibility"></a>Release 3 to Release 4 Compatibility</h2></div></div></div><p>
At the data structure level, Release 4 retains binary compatibility
with Release 3 (the first X Consortium standard release) for all data
structures except
<code class="function">WMShellPart,</code>
<code class="function">TopLevelShellPart</code>,
and
<code class="function">TransientShellPart</code>.
Release 4 changed the argument type to most procedures that now take
arguments of type
<code class="function">XtPointer</code>
and structure members that are now of type
<code class="function">XtPointer</code>
in order to avoid potential ANSI C conformance problems. It is
expected that most implementations will be binary compatible with the
previous definition.
</p><p>
Two fields in
<code class="function">CoreClassPart</code>
were changed from
<code class="function">Boolean</code>
to
<code class="function">XtEnum</code>
to allow implementations additional freedom in specifying the
representations of each. This change should require no source
modification.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Additional_Arguments"></a>Additional Arguments</h3></div></div></div><p>
Arguments were added to the procedure definitions for
<a class="xref" href="#XtInitProc"><code class="function">(*XtInitProc)</code></a>,
<a class="xref" href="#XtSetValuesFunc"><code class="function">(*XtSetValuesFunc)</code></a>,
and
<a class="xref" href="#XtEventHandler"><code class="function">(*XtEventHandler)</code></a>
to provide more information and to
allow event handlers to abort further dispatching of the current event
(caution is advised!). The added arguments to
<a class="xref" href="#XtInitProc"><code class="function">(*XtInitProc)</code></a>
and
<a class="xref" href="#XtSetValuesFunc"><code class="function">(*XtSetValuesFunc)</code></a>
make the initialize_hook and set_values_hook methods
obsolete, but the hooks have been retained for those widgets that used
them in Release 3.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="set_values_almost_Procedures"></a>set_values_almost Procedures</h3></div></div></div><p>
The use of the arguments by a set_values_almost procedure was poorly
described in Release 3 and was inconsistent with other conventions.
</p><p>
The current specification for the manner in which a set_values_almost
procedure returns information to the Intrinsics is not compatible with
the Release 3 specification, and all widget implementations should
verify that any set_values_almost procedures conform to the current
interface.
</p><p>
No known implementation of the Intrinsics correctly implemented the
Release 3 interface, so it is expected that the impact of this
specification change is small.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Query_Geometry"></a>Query Geometry</h3></div></div></div><p>
A composite widget layout routine that calls
<a class="xref" href="#XtQueryGeometry"><code class="function">XtQueryGeometry</code></a>
is now expected to store the complete new geometry in the intended structure;
previously the specification said ``store the changes it intends to
make''. Only by storing the complete geometry does the child have
any way to know what other parts of the geometry may still be
flexible. Existing widgets should not be affected by this, except
to take advantage of the new information.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="unrealizeCallback_Callback_List"></a>unrealizeCallback Callback List</h3></div></div></div><p>
In order to provide a mechanism for widgets to be notified when they
become unrealized through a call to
<a class="xref" href="#XtUnrealizeWidget"><code class="function">XtUnrealizeWidget</code></a>,
the callback
list name ``unrealizeCallback'' has been defined by the Intrinsics. A
widget class that requires notification on unrealize may declare a
callback list resource by this name. No class is required to declare
this resource, but any class that did so in a prior revision may find
it necessary to modify the resource name if it does not wish to use the new
semantics.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Subclasses_of_WMShell"></a>Subclasses of WMShell</h3></div></div></div><p>
The formal adoption of the <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span> as
an X Consortium standard has meant the addition of four fields to
<code class="function">WMShellPart</code>
and one field to
<code class="function">TopLevelShellPart</code>.
In deference to some
widget libraries that had developed their own additional conventions
to provide binary compatibility, these five new fields were added at
the end of the respective data structures.
</p><p>
To provide more convenience for TransientShells, a field was added
to the previously empty
<code class="function">TransientShellPart</code>.
On some architectures the size of the part structure will not
have changed as a result of this.
</p><p>
Any widget implementation whose class is a subclass of
TopLevelShell
or
TransientShell
must at minimum be
recompiled with the new data structure declarations. Because
<code class="function">WMShellPart</code>
no longer contains a contiguous
<code class="function">XSizeHints</code>
data structure,
a subclass that expected to do a single structure assignment of an
<code class="function">XSizeHints</code>
structure to the <span class="emphasis"><em>size_hints</em></span> field of
<code class="function">WMShellPart</code>
must be revised, though the old fields remain at the same positions within
<code class="function">WMShellPart</code>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Resource_Type_Converters"></a>Resource Type Converters</h3></div></div></div><p>
A new interface declaration for resource type converters was defined
to provide more information to converters, to support conversion
cache cleanup with resource reference counting, and to allow
additional procedures to be declared to free resources. The old
interfaces remain (in the compatibility section), and a new set of
procedures was defined that work only with the new type converter
interface.
</p><p>
In the now obsolete old type converter interface, converters are
reminded that they must return the size of the converted value as well
as its address. The example indicated this, but the description of
<a class="xref" href="#XtConverter"><code class="function">(*XtConverter)</code></a>
was incomplete.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="KeySym_Case_Conversion_Procedure"></a>KeySym Case Conversion Procedure</h3></div></div></div><p>
The specification for the
<a class="xref" href="#XtCaseProc"><code class="function">(*XtCaseProc)</code></a>
function type has been changed
to match the Release 3 implementation, which included necessary
additional information required by the function (a pointer to the
display connection), and corrects the argument type of the source
KeySym parameter. No known implementation of the Intrinsics
implemented the previously documented interface.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Nonwidget_Objects_2"></a>Nonwidget Objects</h3></div></div></div><p>
Formal support for nonwidget objects is new to Release 4. A
prototype implementation was latent in at least one Release 3
implementation of the Intrinsics, but the specification has changed
somewhat. The most significant change is the requirement for a
composite widget to declare the
<code class="function">CompositeClassExtension</code>
record with the <span class="emphasis"><em>accepts_objects</em></span> field set to
<code class="function">True</code>
in order to permit a client to create a nonwidget child.
</p><p>
The addition of this extension field ensures that composite widgets
written under Release 3 will not encounter unexpected errors if an
application attempts to create a nonwidget child. In Release 4 there
is no requirement that all composite widgets implement the extra
functionality required to manage windowless children, so the
<span class="emphasis"><em>accepts_objects</em></span> field allows a composite widget to declare that it
is not prepared to do so.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Release_to_Release_Compatibility_2"></a>Release 4 to Release 5 Compatibility</h2></div></div></div><p>
At the data structure level, Release 5 retains complete binary
compatibility with Release 4. The specification of the
<code class="function">ObjectPart</code>,
<code class="function">RectObjPart</code>,
<code class="function">CorePart</code>,
<code class="function">CompositePart</code>,
<code class="function">ShellPart</code>,
<code class="function">WMShellPart</code>,
<code class="function">TopLevelShellPart</code>,
and
<code class="function">ApplicationShellPart</code>
instance records was made less strict to permit implementations to
add internal fields to these structures. Any implementation that
chooses to do so would, of course, force a recompilation.
The Xlib specification for
<code class="function">XrmValue</code>
and
<code class="function">XrmOptionDescRec</code>
was updated to use a new type,
<code class="function">XPointer</code>,
for the <span class="emphasis"><em>addr</em></span> and <span class="emphasis"><em>value</em></span> fields, respectively, to avoid
ANSI C conformance problems. The definition of
<code class="function">XPointer</code>
is binary compatible with the previous implementation.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="baseTranslations_Resource"></a>baseTranslations Resource</h3></div></div></div><p>
A new pseudo-resource, XtNbaseTranslations, was defined to permit
application developers to specify translation tables in application
defaults files while still giving end users the ability to augment
or override individual event sequences. This change will affect
only those applications that wish to take advantage of the new
functionality or those widgets that may have previously defined
a resource named ``baseTranslations''.
</p><p>
Applications wishing to take advantage of the new functionality
would change their application defaults file, e.g., from
</p><div class="literallayout"><p><br />
app.widget.translations: <span class="emphasis"><em>value</em></span><br />
to<br />
app.widget.baseTranslations: <span class="emphasis"><em>value</em></span><br />
</p></div><p>
If it is important to the application to preserve complete
compatibility of the defaults file between different versions
of the application running under Release 4 and Release 5,
the full translations can be replicated in both the ``translations''
and the ``baseTranslations'' resource.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Resource_File_Search_Path"></a>Resource File Search Path</h3></div></div></div><p>
The current specification allows implementations greater flexibility
in defining the directory structure used to hold the application class
and per-user application defaults files. Previous specifications
required the substitution strings to appear in the default path in a
certain order, preventing sites from collecting all the files for
a specific application together in one directory. The Release 5
specification allows the default path to specify the substitution
strings in any order within a single path entry. Users will need to
pay close attention to the documentation for the specific
implementation to know where to find these files and how to specify
their own
<span class="strong"><strong>XFILESEARCHPATH</strong></span>
and
<span class="strong"><strong>XUSERFILESEARCHPATH</strong></span>
values when overriding the system defaults.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Customization_Resource"></a>Customization Resource</h3></div></div></div><p>
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>
supports a new substitution string, %C, for specifying separate
application class resource files according to arbitrary user-specified
categories. The primary motivation for this addition was separate
monochrome and color application class defaults files. The
substitution value is obtained by querying the current resource
database for the application resource name ``customization'', class
``Customization''. Any application that previously used this
resource name and class will need to be aware of the possibly
conflicting semantics.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Per_Screen_Resource_Database"></a>Per-Screen Resource Database</h3></div></div></div><p>
To allow a user to specify separate preferences for each screen of a
display, a per-screen resource specification string has been added and
multiple resource databases are created; one for each screen. This
will affect any application that modified the (formerly unique)
resource database associated with the display subsequent to the Intrinsics
database initialization. Such applications will need to be aware
of the particular screen on which each shell widget is to be created.
</p><p>
Although the wording of the specification changed substantially in the
description of the process by which the resource database(s) is
initialized, the net effect is the same as in prior releases with the
exception of the added per-screen resource specification and the new
customization substitution string in
<a class="xref" href="#XtResolvePathname"><code class="function">XtResolvePathname</code></a>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Internationalization_of_Applications"></a>Internationalization of Applications</h3></div></div></div><p>
Internationalization as defined by ANSI is a technology that
allows support of an application in a single locale. In
adding support for internationalization to the Intrinsics
the restrictions of this model have been followed.
In particular, the new Intrinsics interfaces are designed not to
preclude an application from using other alternatives.
For this reason, no Intrinsics routine makes a call to establish the
locale. However, a convenience routine to establish the
locale at initialize time has been provided, in the form
of a default procedure that must be explicitly installed
if the application desires ANSI C locale behavior.
</p><p>
As many objects in X, particularly resource databases, now inherit
the global locale when they are created, applications wishing to use
the ANSI C locale model should use the new function
<code class="function">XtSetLanguageProc</code>
to do so.
</p><p>
The internationalization additions also define event filters
as a part of the Xlib Input Method specifications. The
Intrinsics enable the use of event filters through additions to
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>.
Applications that may not be dispatching all events through
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
should be reviewed in the context of this new input method mechanism.
</p><p>
In order to permit internationalization of error messages, the name
and path of the error database file are now allowed to be
implementation-dependent.
No adequate standard mechanism has yet been suggested to
allow the Intrinsics to locate the database from localization information
supplied by the client.
</p><p>
The previous specification for the syntax of the language string
specified by
<code class="function">xnlLanguage</code>
has been dropped to avoid potential conflicts with other standards.
The language string syntax is now implementation-defined.
The example syntax cited is consistent with the previous
specification.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Permanently_Allocated_Strings"></a>Permanently Allocated Strings</h3></div></div></div><p>
In order to permit additional memory savings, an Xlib interface was
added to allow the resource manager to avoid copying certain string
constants. The Intrinsics specification was updated to explicitly require
the Object <span class="emphasis"><em>class_name</em></span>, <span class="emphasis"><em>resource_name</em></span>, <span class="emphasis"><em>resource_class</em></span>,
<span class="emphasis"><em>resource_type</em></span>, <span class="emphasis"><em>default_type</em></span> in resource tables, Core <span class="emphasis"><em>actions</em></span>
<span class="emphasis"><em>string</em></span> field, and Constraint <span class="emphasis"><em>resource_name</em></span>, <span class="emphasis"><em>resource_class</em></span>,
<span class="emphasis"><em>resource_type</em></span>, and <span class="emphasis"><em>default_type</em></span> resource fields to be
permanently allocated. This explicit requirement is expected to
affect only applications that may create and destroy classes
on the fly.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Arguments_to_Existing_Functions"></a>Arguments to Existing Functions</h3></div></div></div><p>
The <span class="emphasis"><em>args</em></span> argument to
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>,
<a class="xref" href="#XtVaAppInitialize"><code class="function">XtVaAppInitialize</code></a>,
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>,
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>,
and
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
were changed from
<code class="function">Cardinal</code>*
to int* to conform to pre-existing convention and avoid otherwise
annoying typecasting in ANSI C environments.
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Release_to_Release_Compatibility_3"></a>Release 5 to Release 6 Compatibility</h2></div></div></div><p>
At the data structure level, Release 6 retains binary compatibility
with Release 5 for all data structures except
<code class="function">WMShellPart</code>.
Three resources were added to the specification.
The known implementations had unused space in the data structure,
therefore on some architectures and implementations,
the size of the part structure will not have changed as a result of this.
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Widget_Internals"></a>Widget Internals</h3></div></div></div><p>
Two new widget methods for instance allocation and deallocation were added
to the Object class. These new methods
allow widgets to be treated as C++ objects in the C++ environment
when an appropriate allocation method is specified or inherited
by the widget class.
</p><p>
The textual descriptions of the processes of widget creation and
widget destruction have been edited to provide clarification to widget
writers. Widgets writers may have reason to rely on the specific order of
the stages of widget creation and destruction; with that motivation,
the specification now more exactly describes the process.
</p><p>
As a convenience, an interface to locate a widget class extension
record on a linked list,
<a class="xref" href="#XtGetClassExtension"><code class="function">XtGetClassExtension</code></a>,
has been added.
</p><p>
A new option to allow bundled changes to the managed set of a Composite
widget is introduced in the Composite class extension record.
Widgets that define a change_managed procedure that can accommodate
additions and deletions to the managed set of children in a single
invocation should set allows_change_managed_set to <code class="function">True</code> in the
extension record.
</p><p>
The wording of the process followed by
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>
has changed slightly to better handle changes to the managed set
during phase 2 destroy processing.
</p><p>
A new exposure event compression flag,
<code class="function">XtExposeNoRegion</code>,
was added. Many widgets specify exposure compression, but either
ignore the actual damage region passed to the core expose procedure or
use only the cumulative bounding box data available in the event.
Widgets with expose procedures that do not make use of exact
exposure region information can indicate that the Intrinsics need not
compute the region.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="General_Application_Development"></a>General Application Development</h3></div></div></div><p>
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>
is a new convenience procedure to initialize the toolkit, create an
application context, open an X display connection, and create the
root of the widget instance tree. It is identical to the interface
it replaces,
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>,
in all respects except that it takes an additional argument specifying
the widget class of the root shell to create.
This interface is now the recommended one so that clients may easily
become session participants.
The old convenience procedures appear in the compatibility section.
</p><p>
The toolkit initialization function
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>
may be called multiple times without penalty.
</p><p>
In order to optimize changes in geometry to a set of geometry-managed
children, a new interface,
<a class="xref" href="#XtChangeManagedSet"><code class="function">XtChangeManagedSet</code></a>,
has been added.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Communication_with_Window_and_Session_Managers"></a>Communication with Window and Session Managers</h3></div></div></div><p>
The revision of the <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span> as an X Consortium standard has resulted
in the addition of three fields to the specification of
<code class="function">WMShellPart</code>.
These are <span class="emphasis"><em>urgency</em></span>, <span class="emphasis"><em>client_leader</em></span>, and <span class="emphasis"><em>window_role</em></span>.
</p><p>
The adoption of the <span class="emphasis"><em>X Session Management Protocol</em></span> as an X Consortium
standard has resulted in the addition of a new shell widget,
<code class="function">SessionShell</code>,
and an accompanying subclass verification interface,
<code class="function">XtIsSessionShell</code>.
This widget provides support for communication between an application
and a session manager, as well as a window manager.
In order to preserve compatibility with existing subclasses of
<code class="function">ApplicationShell</code>,
the
<code class="function">ApplicationShell</code>
was subclassed to create the new widget class.
The session protocol requires a modal response to certain checkpointing
operations by participating applications. The
<code class="function">SessionShell</code>
structures
the application's notification of and responses to messages from the session
manager by use of various callback lists and by use of the new interfaces
<a class="xref" href="#XtSessionGetToken"><code class="function">XtSessionGetToken</code></a>
and
<a class="xref" href="#XtSessionReturnToken"><code class="function">XtSessionReturnToken</code></a>.
There is also a new command line argument, -xtsessionID, which facilitates
the session manager in restarting applications based on the Intrinsics.
</p><p>
The resource name and class strings defined by the Intrinsics shell
widgets in
<code class="function"><X11/Shell.h></code>
are now listed in Appendix E. The addition of a new symbol
for the
<code class="function">WMShell</code>
<span class="emphasis"><em>wait_for_wm</em></span> resource was made to bring the external symbol
and the string it represents into agreement. The actual resource name
string in
<code class="function">WMShell</code>
has not changed.
The resource representation type of the XtNwinGravity resource of the
<code class="function">WMShell</code>
was changed to XtRGravity in order to register a type
converter so that window gravity resource values could be specified by name.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Geometry_Management_2"></a>Geometry Management</h3></div></div></div><p>
A clarification to the specification was made to indicate that geometry
requests may include current values along with the requested changes.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Event_Management_2"></a>Event Management</h3></div></div></div><p>
In Release 6, support is provided for registering selectors
and event handlers for events generated by X protocol extensions
and for dispatching those events to the appropriate widget.
The new event handler registration interfaces are
<a class="xref" href="#XtInsertEventTypeHandler"><code class="function">XtInsertEventTypeHandler</code></a>
and
<a class="xref" href="#XtRemoveEventTypeHandler"><code class="function">XtRemoveEventTypeHandler</code></a>.
Since the mechanism to indicate selection of extension events is specific
to the extension being used, the Intrinsics introduces
<a class="xref" href="#XtRegisterExtensionSelector"><code class="function">XtRegisterExtensionSelector</code></a>,
which allows the application to select for the events of interest.
In order to change the dispatching algorithm to accommodate extension events
as well as core X protocol events,
the Intrinsics event dispatcher may now be replaced or enveloped
by the application with
<a class="xref" href="#XtSetEventDispatcher"><code class="function">XtSetEventDispatcher</code></a>.
The dispatcher may wish to call
<a class="xref" href="#XtGetKeyboardFocusWidget"><code class="function">XtGetKeyboardFocusWidget</code></a>
to determine the widget with the current Intrinsics keyboard focus.
A dispatcher, after determining the destination widget, may use
<a class="xref" href="#XtDispatchEventToWidget"><code class="function">XtDispatchEventToWidget</code></a>
to cause the event to be dispatched to the event handlers registered
by a specific widget.
</p><p>
To permit the dispatching of events
for nonwidget drawables, such as pixmaps that are not associated
with a widget's window,
<a class="xref" href="#XtRegisterDrawable"><code class="function">XtRegisterDrawable</code></a>
and
<a class="xref" href="#XtUnregisterDrawable"><code class="function">XtUnregisterDrawable</code></a>
have been added to the library. A related update was made to
the description of
<a class="xref" href="#XtWindowToWidget"><code class="function">XtWindowToWidget</code></a>.
</p><p>
The library is now thread-safe, allowing one thread at a time to
enter the library and protecting global data as necessary from concurrent use.
Threaded toolkit applications are supported by the
new interfaces
<a class="xref" href="#XtToolkitThreadInitialize"><code class="function">XtToolkitThreadInitialize</code></a>,
<a class="xref" href="#XtAppLock"><code class="function">XtAppLock</code></a>,
<a class="xref" href="#XtAppUnlock"><code class="function">XtAppUnlock</code></a>,
<a class="xref" href="#XtAppSetExitFlag"><code class="function">XtAppSetExitFlag</code></a>,
and
<a class="xref" href="#XtAppGetExitFlag"><code class="function">XtAppGetExitFlag</code></a>.
Widget writers may also use
<a class="xref" href="#XtProcessLock"><code class="function">XtProcessLock</code></a>
and
<a class="xref" href="#XtProcessUnlock"><code class="function">XtProcessUnlock</code></a>.
</p><p>
Safe handling of POSIX signals and other asynchronous notifications
is now provided by use of
<a class="xref" href="#XtAppAddSignal"><code class="function">XtAppAddSignal</code></a>,
<a class="xref" href="#XtNoticeSignal"><code class="function">XtNoticeSignal</code></a>,
and
<a class="xref" href="#XtRemoveSignal"><code class="function">XtRemoveSignal</code></a>.
</p><p>
The application can receive notification of an impending block
in the Intrinsics event manager by registering interest through
<a class="xref" href="#XtAppAddBlockHook"><code class="function">XtAppAddBlockHook</code></a>
and
<a class="xref" href="#XtRemoveBlockHook"><code class="function">XtRemoveBlockHook</code></a>.
</p><p>
<a class="xref" href="#XtLastEventProcessed"><code class="function">XtLastEventProcessed</code></a>
returns the most recent event passed to
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>
for a specified display.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Resource_Management_2"></a>Resource Management</h3></div></div></div><p>
Resource converters are registered by the Intrinsics for window gravity
and for three new resource types associated with session participation:
RestartStyle, CommandArgArray and DirectoryString.
</p><p>
The file search path syntax has been extended to make it easier to
include the default search path, which controls resource
database construction, by using the new substitution string, %D.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Translation_Management_2"></a>Translation Management</h3></div></div></div><p>
The default key translator now recognizes the NumLock modifier.
If NumLock is on and the second keysym is a keypad keysym
(a standard keysym named with a ``KP'' prefix or a
vendor-specific keysym in the hexadecimal range 0x11000000 to 0x1100FFFF),
then the default key translator will
use the first keysym if Shift and/or ShiftLock is on and will
use the second keysym if neither is on. Otherwise, it will
ignore NumLock and apply the normal protocol semantics.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="Selections"></a>Selections</h3></div></div></div><p>
The targets of selection requests may be parameterized, as described
by the revised <span class="emphasis"><em>Inter-Client Communication Conventions Manual.</em></span>.
When such requests are made,
<a class="xref" href="#XtSetSelectionParameters"><code class="function">XtSetSelectionParameters</code></a>
is used by the requestor to specify the target parameters and
<a class="xref" href="#XtGetSelectionParameters"><code class="function">XtGetSelectionParameters</code></a>
is used by the selection owner to retrieve the parameters.
When a parameterized target is specified in the context of a bundled
request for multiple targets,
<a class="xref" href="#XtCreateSelectionRequest"><code class="function">XtCreateSelectionRequest</code></a>,
<a class="xref" href="#XtCancelSelectionRequest"><code class="function">XtCancelSelectionRequest</code></a>,
and
<a class="xref" href="#XtSendSelectionRequest"><code class="function">XtSendSelectionRequest</code></a>
are used to envelop the assembly of the request.
When the parameters themselves are the names of properties,
the Intrinsics provides support for the economical use of property atom names;
see
<a class="xref" href="#XtReservePropertyAtom"><code class="function">XtReservePropertyAtom</code></a>
and
<a class="xref" href="#XtReleasePropertyAtom"><code class="function">XtReleasePropertyAtom</code></a>.
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="External_Agent_Hooks"></a>External Agent Hooks</h3></div></div></div><p>
External agent hooks were added for the benefit of applications
that instrument other applications for purposes of accessibility,
testing, and customization. The external agent and the application
communicate by a shared protocol which is transparent to the application.
The hook callbacks permit the external agent to register interest
in groups or classes of toolkit activity and to be notified of the
type and details of the activity as it occurs. The new interfaces
related to this effort are
<a class="xref" href="#XtHooksOfDisplay"><code class="function">XtHooksOfDisplay</code></a>,
which returns the hook registration widget, and
<a class="xref" href="#XtGetDisplays"><code class="function">XtGetDisplays</code></a>,
which returns a list of the X displays associated with an application context.
</p></div></div></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="Resource_File_Format"></a>Appendix A. Resource File Format</h1></div></div></div><p>
A resource file contains text representing the default resource values for an
application or set of applications.
</p><p>
The format of resource files is defined by
<span class="emphasis"><em>Xlib — C Language X Interface.</em></span> and is reproduced here
for convenience only.
</p><p>The format of a resource specification is</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left">ResourceLine</td><td align="left">= Comment | IncludeFile | ResourceSpec | <empty line></td></tr><tr><td align="left">Comment</td><td align="left">="!" {<any character except null or newline>}</td></tr><tr><td align="left">IncludeFile</td><td align="left">= "#" WhiteSpace "include" WhiteSpace FileName WhiteSpace</td></tr><tr><td align="left">FileName</td><td align="left">= <valid filename for operating system></td></tr><tr><td align="left">ResourceSpec</td><td align="left">= WhiteSpace ResourceName WhiteSpace ":" WhiteSpace Value</td></tr><tr><td align="left">ResourceName</td><td align="left">= [Binding] {Component Binding} ComponentName</td></tr><tr><td align="left">Binding</td><td align="left">="." | "*"</td></tr><tr><td align="left">WhiteSpace</td><td align="left">= {<space> | <horizontal tab>}</td></tr><tr><td align="left">Component</td><td align="left">= "?" | ComponentName</td></tr><tr><td align="left">ComponentName</td><td align="left">= NameChar {NameChar}</td></tr><tr><td align="left">NameChar</td><td align="left">= "a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-"</td></tr><tr><td align="left">Value</td><td align="left">={<any character except null or unescaped newline>}</td></tr></tbody></table></div><p>
Elements separated by vertical bar (|) are alternatives.
Curly braces ({...}) indicate zero or more repetitions
of the enclosed elements.
Square brackets ([...]) indicate that the enclosed element is optional.
Quotes ("...") are used around literal characters.
</p><p>
If the last character on a line is a backslash (\),
that line is assumed to continue on the next line.
</p><p>
To allow a Value to begin with whitespace,
the two-character sequence "\<span class="emphasis"><em>space</em></span>" (backslash followed by space)
is recognized and replaced by a space character,
and the two-character sequence "\<span class="emphasis"><em>tab</em></span>"
(backslash followed by horizontal tab)
is recognized and replaced by a horizontal tab character.
</p><p>
To allow a Value to contain embedded newline characters,
the two-character sequence "\n" is recognized and replaced by a
newline character.
To allow a Value to be broken across multiple lines in a text file,
the two-character sequence "\<span class="emphasis"><em>newline</em></span>"
(backslash followed by newline) is
recognized and removed from the value.
</p><p>
To allow a Value to contain arbitrary character codes,
the four-character sequence "\<span class="emphasis"><em>nnn</em></span>",
where each <span class="emphasis"><em>n</em></span> is a digit character in the range of "0"-"7",
is recognized and replaced with a single byte that contains
the octal value specified by the sequence.
Finally, the two-character sequence "\\" is recognized
and replaced with a single backslash.
</p></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="Translation_Table_Syntax"></a>Appendix B. Translation Table Syntax</h1></div></div></div><p><span class="strong"><strong>Notation</strong></span></p><p>
Syntax is specified in EBNF notation with the following conventions:
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left">[ a ]</td><td align="left">Means either nothing or "a"</td></tr><tr><td align="left">{ a }</td><td align="left">Means zero or more occurrences of "a"</td></tr><tr><td align="left">( a | b )</td><td align="left">Means either "a" or "b"</td></tr><tr><td align="left">\\n</td><td align="left">Is the newline character</td></tr></tbody></table></div><p>
All terminals are enclosed in double quotation marks (" ").
Informal descriptions are enclosed in angle brackets (< >).
Syntax
</p><p>The syntax of a translation table is</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left">translationTable</td><td align="left">= [ directive ] { production }</td></tr><tr><td align="left">directive</td><td align="left">= ( "#replace" | "#override" | "#augment" ) "\\\\n"</td></tr><tr><td align="left">production</td><td align="left">= lhs ":" rhs "\\\\n"</td></tr><tr><td align="left">lhs</td><td align="left">= ( event | keyseq ) { "," (event | keyseq) }</td></tr><tr><td align="left">keyseq</td><td align="left">= """ keychar {keychar} """</td></tr><tr><td align="left">keychar</td><td align="left">= [ "^" | "$" | "\\\\" ] <ISO Latin 1 character></td></tr><tr><td align="left">event</td><td align="left">= [modifier_list] "<"event_type">" [ "(" count["+"] ")" ] {detail}</td></tr><tr><td align="left">modifier_list</td><td align="left">= ( ["!"] [":"] {modifier} ) | "None"</td></tr><tr><td align="left">modifier</td><td align="left">= ["~"] modifier_name</td></tr><tr><td align="left">count</td><td align="left">= ("1" | "2" | "3" | "4" | ...)</td></tr><tr><td align="left">modifier_name</td><td align="left">= "@" <keysym> | <see ModifierNames table below></td></tr><tr><td align="left">event_type</td><td align="left">= <see Event Types table below></td></tr><tr><td align="left">detail</td><td align="left">= <event specific details></td></tr><tr><td align="left">rhs</td><td align="left">= { name "(" [params] ")" }</td></tr><tr><td align="left">name</td><td align="left">= namechar { namechar }</td></tr><tr><td align="left">namechar</td><td align="left">= { "a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-" }</td></tr><tr><td align="left">params</td><td align="left">= string {"," string}</td></tr><tr><td align="left">string</td><td align="left">= quoted_string | unquoted_string</td></tr><tr><td align="left">quoted_string</td><td align="left">= <span class="quote">“<span class="quote">"</span>”</span> {<Latin 1 character> | escape_char} ["\\\\" ] <span class="quote">“<span class="quote">"</span>”</span></td></tr><tr><td align="left">escape_char</td><td align="left">= "\\""</td></tr><tr><td align="left">unquoted_string</td><td align="left">= {<Latin 1 character except space, tab, ",", "\\n", ")">}</td></tr></tbody></table></div><p>
The <span class="emphasis"><em>params</em></span> field is parsed into a list of
<code class="function">String</code>
values that will be passed to the named action procedure. A
<span class="emphasis"><em>quoted string</em></span> may contain an embedded quotation mark if the
quotation mark is preceded by a single backslash (\). The
three-character sequence "\\\"" is interpreted as "single backslash
followed by end-of-string".
</p><p><span class="strong"><strong>Modifier Names</strong></span></p><p>
The modifier field is used to specify standard X keyboard and button
modifier mask bits.
Modifiers are legal on event types
<code class="function">KeyPress</code>,
<code class="function">KeyRelease</code>,
<code class="function">ButtonPress</code>,
<code class="function">ButtonRelease</code>,
<code class="function">MotionNotify</code>,
<code class="function">EnterNotify</code>,
<code class="function">LeaveNotify</code>,
and their abbreviations.
An error is generated when a translation table
that contains modifiers for any other events is parsed.
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
If the modifier list has no entries and is not "None",
it means "don't care" on all modifiers.
</p></li><li class="listitem"><p>
If an exclamation point (!) is specified at the beginning
of the modifier list,
it means that the listed modifiers must be in the correct state
and no other modifiers can be asserted.
</p></li><li class="listitem"><p>
If any modifiers are specified
and an exclamation point (!) is not specified,
it means that the listed modifiers must be in the
correct state and "don't care" about any other modifiers.
</p></li><li class="listitem"><p>
If a modifier is preceded by a tilde (~),
it means that that modifier must not be asserted.
</p></li><li class="listitem"><p>
If "None" is specified, it means no modifiers can be asserted.
</p></li><li class="listitem"><p>
If a colon (:) is specified at the beginning of the modifier list,
it directs the Intrinsics to apply any standard modifiers in the
event to map the event keycode into a KeySym.
The default standard modifiers are Shift and Lock,
with the interpretation as defined in <span class="emphasis"><em>X Window
System Protocol</em></span>, Section 5.
The resulting KeySym must exactly match the specified
KeySym, and the nonstandard modifiers in the event must match the
modifier list.
For example, ":<Key>a" is distinct from ":<Key>A",
and ":Shift<Key>A" is distinct from ":<Key>A".
</p></li><li class="listitem"><p>
If both an exclamation point (!) and a colon (:) are specified at
the beginning of the modifier list, it means that the listed
modifiers must be in the correct state and that no other modifiers
except the standard modifiers can be asserted. Any standard
modifiers in the event are applied as for colon (:) above.
</p></li><li class="listitem"><p>
If a colon (:) is not specified,
no standard modifiers are applied.
Then, for example, "<Key>A" and "<Key>a" are equivalent.
</p></li></ul></div><p>
In key sequences,
a circumflex (^) is an abbreviation for the Control modifier,
a dollar sign ($) is an abbreviation for Meta,
and a backslash (\) can be used to quote any
character, in particular a double quote ("), a circumflex (^),
a dollar sign ($), and another backslash (\).
Briefly:
</p><div class="literallayout"><p><br />
No modifiers: None <event> detail<br />
Any modifiers: <event> detail<br />
Only these modifiers: ! mod1 mod2 <event> detail<br />
These modifiers and any others: mod1 mod2 <event> detail<br />
</p></div><p>
The use of "None" for a modifier list is identical to the use
of an exclamation point with no modifers.
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Modifier</th><th align="left">Abbreviation</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left">Ctrl</td><td align="left">c</td><td align="left">Control modifier bit</td></tr><tr><td align="left">Shift</td><td align="left">s</td><td align="left">Shift modifier bit</td></tr><tr><td align="left">Lock</td><td align="left">l</td><td align="left">Lock modifier bit</td></tr><tr><td align="left">Meta</td><td align="left">m</td><td align="left">Meta key modifier</td></tr><tr><td align="left">Hyper</td><td align="left">h</td><td align="left">Hyper key modifier</td></tr><tr><td align="left">Super</td><td align="left">su</td><td align="left">Super key modifier</td></tr><tr><td align="left">Alt</td><td align="left">a</td><td align="left">Alt key modifier</td></tr><tr><td align="left">Mod1</td><td align="left"> </td><td align="left">Mod1 modifier bit</td></tr><tr><td align="left">Mod2</td><td align="left"> </td><td align="left">Mod2 modifier bit</td></tr><tr><td align="left">Mod3</td><td align="left"> </td><td align="left">Mod3 modifier bit</td></tr><tr><td align="left">Mod4</td><td align="left"> </td><td align="left">Mod4 modifier bit</td></tr><tr><td align="left">Mod5</td><td align="left"> </td><td align="left">Mod5 modifier bit</td></tr><tr><td align="left">Button1</td><td align="left"> </td><td align="left">Button1 modifier bit</td></tr><tr><td align="left">Button2</td><td align="left"> </td><td align="left">Button2 modifier bit</td></tr><tr><td align="left">Button3</td><td align="left"> </td><td align="left">Button3 modifier bit</td></tr><tr><td align="left">Button4</td><td align="left"> </td><td align="left">Button4 modifier bit</td></tr><tr><td align="left">Button5</td><td align="left"> </td><td align="left">Button5 modifier bit</td></tr><tr><td align="left">None</td><td align="left"> </td><td align="left">No modifiers</td></tr><tr><td align="left">Any</td><td align="left"> </td><td align="left">Any modifier combination</td></tr></tbody></table></div><p>
A key modifier is any modifier bit one of whose corresponding KeyCodes
contains the corresponding left or right KeySym.
For example,
"m" or "Meta" means any modifier bit mapping to a KeyCode
whose KeySym list contains XK_Meta_L or XK_Meta_R.
Note that this interpretation is for each display,
not global or even for each application context.
The Control, Shift, and Lock modifier names refer
explicitly to the corresponding modifier bits;
there is no additional interpretation of KeySyms for these modifiers.
</p><p>
Because it is possible to associate arbitrary KeySyms with modifiers, the set of
key modifiers is extensible. The "@" <keysym> syntax means any
modifier bit whose corresponding KeyCode contains the specified KeySym name.
</p><p>
A modifier_list/KeySym combination in a translation matches a
modifiers/KeyCode combination in an event in the following ways:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
If a colon (:) is used, the Intrinsics call the display's
<a class="xref" href="#XtKeyProc"><code class="function">(*XtKeyProc)</code></a>
with the KeyCode and modifiers.
To match, (<span class="emphasis"><em>modifiers</em></span> & ~<span class="emphasis"><em>modifiers_return</em></span>) must equal <span class="emphasis"><em>modifier_list</em></span>, and
<span class="emphasis"><em>keysym_return</em></span> must equal the given KeySym.
</p></li><li class="listitem"><p>
If (:) is not used, the Intrinsics mask off all don't-care bits from the
modifiers.
This value must be equal to <span class="emphasis"><em>modifier_list</em></span>.
Then, for each possible combination of
don't-care modifiers in the modifier list, the Intrinsics call the display's
<a class="xref" href="#XtKeyProc"><code class="function">(*XtKeyProc)</code></a>
with the KeyCode and that combination ORed with the cared-about modifier bits
from the event.
<span class="emphasis"><em>Keysym_return</em></span> must match the KeySym in the translation.
</p></li></ol></div><p><span class="strong"><strong>Event Types</strong></span></p><p>
The event-type field describes XEvent types.
In addition to the standard
Xlib symbolic event type names, the following event type synonyms
are defined:
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Type</th><th align="left">Meaning</th></tr></thead><tbody><tr><td align="left">Key</td><td align="left"><code class="function">KeyPress</code></td></tr><tr><td align="left">KeyDown</td><td align="left"><code class="function">KeyPress</code></td></tr><tr><td align="left">KeyUp</td><td align="left"><code class="function">KeyRelease</code></td></tr><tr><td align="left">BtnDown</td><td align="left"><code class="function">ButtonPress</code></td></tr><tr><td align="left">BtnUp</td><td align="left"><code class="function">ButtonRelease</code></td></tr><tr><td align="left">Motion</td><td align="left"><code class="function">MotionNotify</code></td></tr><tr><td align="left">PtrMoved</td><td align="left"><code class="function">MotionNotify</code></td></tr><tr><td align="left">MouseMoved</td><td align="left"><code class="function">MotionNotify</code></td></tr><tr><td align="left">Enter</td><td align="left"><code class="function">EnterNotify</code></td></tr><tr><td align="left">EnterWindow</td><td align="left"><code class="function">EnterNotify</code></td></tr><tr><td align="left">Leave</td><td align="left"><code class="function">LeaveNotify</code></td></tr><tr><td align="left">LeaveWindow</td><td align="left"><code class="function">LeaveNotify</code></td></tr><tr><td align="left">FocusIn</td><td align="left"><code class="function">FocusIn</code></td></tr><tr><td align="left">FocusOut</td><td align="left"><code class="function">FocusOut</code></td></tr><tr><td align="left">Keymap</td><td align="left"><code class="function">KeymapNotify</code></td></tr><tr><td align="left">Expose</td><td align="left"><code class="function">Expose</code></td></tr><tr><td align="left">GrExp</td><td align="left"><code class="function">GraphicsExpose</code></td></tr><tr><td align="left">NoExp</td><td align="left"><code class="function">NoExpose</code></td></tr><tr><td align="left">Visible</td><td align="left"><code class="function">VisibilityNotify</code></td></tr><tr><td align="left">Create</td><td align="left"><code class="function">CreateNotify</code></td></tr><tr><td align="left">Destroy</td><td align="left"><code class="function">DestroyNotify</code></td></tr><tr><td align="left">Unmap</td><td align="left"><code class="function">UnmapNotify</code></td></tr><tr><td align="left">Map</td><td align="left"><code class="function">MapNotify</code></td></tr><tr><td align="left">MapReq</td><td align="left"><code class="function">MapRequest</code></td></tr><tr><td align="left">Reparent</td><td align="left"><code class="function">ReparentNotify</code></td></tr><tr><td align="left">Configure</td><td align="left"><code class="function">ConfigureNotify</code></td></tr><tr><td align="left">ConfigureReq</td><td align="left"><code class="function">ConfigureRequest</code></td></tr><tr><td align="left">Grav</td><td align="left"><code class="function">GravityNotify</code></td></tr><tr><td align="left">ResReq</td><td align="left"><code class="function">ResizeRequest</code></td></tr><tr><td align="left">Circ</td><td align="left"><code class="function">CirculateNotify</code></td></tr><tr><td align="left">CircReq</td><td align="left"><code class="function">CirculateRequest</code></td></tr><tr><td align="left">Prop</td><td align="left"><code class="function">PropertyNotify</code></td></tr><tr><td align="left">SelClr</td><td align="left"><code class="function">SelectionClear</code></td></tr><tr><td align="left">SelReq</td><td align="left"><code class="function">SelectionRequest</code></td></tr><tr><td align="left">Select</td><td align="left"><code class="function">SelectionNotify</code></td></tr><tr><td align="left">Clrmap</td><td align="left"><code class="function">ColormapNotify</code></td></tr><tr><td align="left">Message</td><td align="left"><code class="function">ClientMessage</code></td></tr><tr><td align="left">Mapping</td><td align="left"><code class="function">MappingNotify</code></td></tr></tbody></table></div><p>The supported abbreviations are:</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Abbreviation</th><th align="left">Event Type</th><th align="left">Including</th></tr></thead><tbody><tr><td align="left">Ctrl</td><td align="left"><code class="function">KeyPress</code></td><td align="left">with Control modifier</td></tr><tr><td align="left">Meta</td><td align="left"><code class="function">KeyPress</code></td><td align="left">with Meta modifier</td></tr><tr><td align="left">Shift</td><td align="left"><code class="function">KeyPress</code></td><td align="left">with Shift modifier</td></tr><tr><td align="left">Btn1Down</td><td align="left"><code class="function">ButtonPress</code></td><td align="left">with Button1 detail</td></tr><tr><td align="left">Btn1Up</td><td align="left"><code class="function">ButtonRelease</code></td><td align="left">with Button1 detail</td></tr><tr><td align="left">Btn2Down</td><td align="left"><code class="function">ButtonPress</code></td><td align="left">with Button2 detail</td></tr><tr><td align="left">Btn2Up</td><td align="left"><code class="function">ButtonRelease</code></td><td align="left">with Button2 detail</td></tr><tr><td align="left">Btn3Down</td><td align="left"><code class="function">ButtonPress</code></td><td align="left">with Button3 detail</td></tr><tr><td align="left">Btn3Up</td><td align="left"><code class="function">ButtonRelease</code></td><td align="left">with Button3 detail</td></tr><tr><td align="left">Btn4Down</td><td align="left"><code class="function">ButtonPress</code></td><td align="left">with Button4 detail</td></tr><tr><td align="left">Btn4Up</td><td align="left"><code class="function">ButtonRelease</code></td><td align="left">with Button4 detail</td></tr><tr><td align="left">Btn5Down</td><td align="left"><code class="function">ButtonPress</code></td><td align="left">with Button5 detail</td></tr><tr><td align="left">Btn5Up</td><td align="left"><code class="function">ButtonRelease</code></td><td align="left">with Button5 detail</td></tr><tr><td align="left">BtnMotion</td><td align="left"><code class="function">MotionNotify</code></td><td align="left">with any button modifier</td></tr><tr><td align="left">Btn1Motion</td><td align="left"><code class="function">MotionNotify</code></td><td align="left">with Button1 modifier</td></tr><tr><td align="left">Btn2Motion</td><td align="left"><code class="function">MotionNotify</code></td><td align="left">with Button2 modifier</td></tr><tr><td align="left">Btn3Motion</td><td align="left"><code class="function">MotionNotify</code></td><td align="left">with Button3 modifier</td></tr><tr><td align="left">Btn4Motion</td><td align="left"><code class="function">MotionNotify</code></td><td align="left">with Button4 modifier</td></tr><tr><td align="left">Btn5Motion</td><td align="left"><code class="function">MotionNotify</code></td><td align="left">with Button5 modifier</td></tr></tbody></table></div><p>
The detail field is event-specific and normally corresponds to the
detail field of the corresponding event as described
by <span class="emphasis"><em>X Window System Protocol</em></span>, Section 11.
The detail field is supported for the following event types:
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left">KeyPress</td><td align="left">KeySym from event <span class="emphasis"><em>detail</em></span> (keycode)</td></tr><tr><td align="left">KeyRelease</td><td align="left">KeySym from event <span class="emphasis"><em>detail</em></span> (keycode)</td></tr><tr><td align="left">ButtonPress</td><td align="left">button from event <span class="emphasis"><em>detail</em></span></td></tr><tr><td align="left">ButtonRelease</td><td align="left">button from event <span class="emphasis"><em>detail</em></span></td></tr><tr><td align="left">MotionNotify</td><td align="left">event <span class="emphasis"><em>detail</em></span></td></tr><tr><td align="left">EnterNotify</td><td align="left">event <span class="emphasis"><em>mode</em></span></td></tr><tr><td align="left">LeaveNotify</td><td align="left">event <span class="emphasis"><em>mode</em></span></td></tr><tr><td align="left">FocusIn</td><td align="left">event <span class="emphasis"><em>mode</em></span></td></tr><tr><td align="left">FocusOut</td><td align="left">event <span class="emphasis"><em>mode</em></span></td></tr><tr><td align="left">PropertyNotify</td><td align="left"><span class="emphasis"><em>atom</em></span></td></tr><tr><td align="left">SelectionClear</td><td align="left"><span class="emphasis"><em>selection</em></span></td></tr><tr><td align="left">SelectionRequest</td><td align="left"><span class="emphasis"><em>selection</em></span></td></tr><tr><td align="left">SelectionNotify</td><td align="left"><span class="emphasis"><em>selection</em></span></td></tr><tr><td align="left">ClientMessage</td><td align="left"><span class="emphasis"><em>type</em></span></td></tr><tr><td align="left">MappingNotify</td><td align="left"><span class="emphasis"><em>request</em></span></td></tr></tbody></table></div><p>
If the event type is
<code class="function">KeyPress</code>
or
<code class="function">KeyRelease</code>,
the detail field
specifies a KeySym name in standard format which is matched against
the event as described above, for example, <Key>A.
</p><p>
For the
<code class="function">PropertyNotify</code>,
<code class="function">SelectionClear</code>,
<code class="function">SelectionRequest</code>,
<code class="function">SelectionNotify</code>,
and
<code class="function">ClientMessage</code>
events the detail field is specified
as an atom name; for example, <Message>WM_PROTOCOLS. For the
<code class="function">MotionNotify</code>,
<code class="function">EnterNotify</code>,
<code class="function">LeaveNotify</code>,
<code class="function">FocusIn</code>,
<code class="function">FocusOut</code>,
and
<code class="function">MappingNotify</code>
events, either the symbolic constants as defined by
<span class="emphasis"><em>X Window
System Protocol</em></span>, Section 11,
or the numeric values may be specified.
</p><p>
If no detail field is specified, then any value in the event detail is
accepted as a match.
</p><p>
A KeySym can be specified as any of the standard KeySym names,
a hexadecimal number prefixed with "0x" or "0X",
an octal number prefixed with "0", or a decimal number.
A KeySym expressed as a single digit is interpreted as the
corresponding Latin 1 KeySym, for example, "0" is the KeySym XK_0.
Other single character KeySyms are treated as literal constants from Latin 1,
for example, "!" is treated as 0x21.
Standard KeySym names are as defined in
<code class="function"><X11/keysymdef.h></code>
with the "XK_" prefix removed.
</p><p><span class="strong"><strong>Canonical Representation</strong></span></p><p>
Every translation table has a unique, canonical text representation. This
representation is passed to a widget's
<code class="function">display_accelerator</code>
procedure to describe the accelerators installed on that widget.
The canonical representation of a translation table is (see also
"Syntax")
</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left">translationTable</td><td align="left">= { production }
</td></tr><tr><td align="left">production</td><td align="left">= lhs ":" rhs "\\n"
</td></tr><tr><td align="left">lhs</td><td align="left">=event { "," event }
</td></tr><tr><td align="left">event</td><td align="left">=[modifier_list] "<"event_type">" [ "(" count["+"] ")" ] {detail}
</td></tr><tr><td align="left">modifier_list</td><td align="left">= ["!"] [":"] {modifier}
</td></tr><tr><td align="left">modifier</td><td align="left">= ["˜"] modifier_name
</td></tr><tr><td align="left">count</td><td align="left">=("1" | "2" | "3" | "4" | ...)
</td></tr><tr><td align="left">modifier_name</td><td align="left">= "@" <keysym> | <see canonical modifier names below>
</td></tr><tr><td align="left">event_type</td><td align="left">= <see canonical event types below>
</td></tr><tr><td align="left">detail</td><td align="left">=<event-specific details>
</td></tr><tr><td align="left">rhs</td><td align="left">={ name "(" [params] ")" }
</td></tr><tr><td align="left">name</td><td align="left">=namechar { namechar }
</td></tr><tr><td align="left">namechar</td><td align="left">= { "a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-" }
</td></tr><tr><td align="left">params</td><td align="left">=string {"," string}
</td></tr><tr><td align="left">string</td><td align="left">=quoted_string
</td></tr><tr><td align="left">quoted_string</td><td align="left">= <span class="quote">“<span class="quote">"</span>”</span> {<Latin 1 character> | escape_char} ["\\\\" ] <span class="quote">“<span class="quote">"</span>”</span>
</td></tr><tr><td align="left">escape_char</td><td align="left">= "\\""
</td></tr></tbody></table></div><p>The canonical modifier names are</p><div class="literallayout"><p><br />
Ctrl Mod1 Button1<br />
Shift Mod2 Button2<br />
Lock Mod3 Button3<br />
Mod4 Button4<br />
Mod5 Button5<br />
</p></div><p>The canonical event types are</p><div class="informaltable"><table border="0"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><tbody><tr><td align="left">KeyPress</td><td align="left">KeyRelease</td></tr><tr><td align="left">ButtonPress</td><td align="left">ButtonRelease</td></tr><tr><td align="left">MotionNotify</td><td align="left">EnterNotify</td></tr><tr><td align="left">LeaveNotify</td><td align="left">FocusIn</td></tr><tr><td align="left">FocusOut</td><td align="left">KeymapNotify</td></tr><tr><td align="left">Expose</td><td align="left">GraphicsExpose,</td></tr><tr><td align="left">NoExpose</td><td align="left">VisibilityNotify</td></tr><tr><td align="left">CreateNotify</td><td align="left">DestroyNotify</td></tr><tr><td align="left">UnmapNotify</td><td align="left">MapNotify</td></tr><tr><td align="left">MapRequest</td><td align="left">ReparentNotify</td></tr><tr><td align="left">ConfigureNotify</td><td align="left">ConfigureRequest</td></tr><tr><td align="left">GravityNotify</td><td align="left">ResizeRequest</td></tr><tr><td align="left">CirculateNotify</td><td align="left">CirculateRequest</td></tr><tr><td align="left">PropertyNotify</td><td align="left">SelectionClear</td></tr><tr><td align="left">SelectionRequest</td><td align="left">SelectionNotify</td></tr><tr><td align="left">ColormapNotify</td><td align="left">ClientMessage</td></tr></tbody></table></div><p><span class="strong"><strong>Examples</strong></span></p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Always put more specific events in the table before more general ones:
</p><div class="literallayout"><p><br />
Shift <Btn1Down> : twas()\n\<br />
<Btn1Down> : brillig()<br />
</p></div></li><li class="listitem"><p>
For double-click on Button1 Up with Shift, use this specification:
</p><div class="literallayout"><p><br />
Shift<Btn1Up>(2) : and()<br />
</p></div></li><li class="listitem"><p>
This is equivalent to the following line with appropriate timers set
between events:
</p><div class="literallayout"><p><br />
Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down>,Shift<Btn1Up> : and()<br />
</p></div></li><li class="listitem"><p>
For double-click on Button1 Down with Shift, use this specification:
</p><div class="literallayout"><p><br />
Shift<Btn1Down>(2) : the()<br />
</p></div></li><li class="listitem"><p>
This is equivalent to the following line with appropriate timers set
between events:
</p><div class="literallayout"><p><br />
Shift<Btn1Down>,Shift<Btn1Up>,Shift<Btn1Down> : the()<br />
</p></div></li><li class="listitem"><p>
Mouse motion is always discarded when it occurs between events in a table
where no motion event is specified:
</p><div class="literallayout"><p><br />
<Btn1Down>,<Btn1Up> : slithy()<br />
</p></div><p>
This is taken, even if the pointer moves a bit between the down and
up events.
Similarly, any motion event specified in a translation matches any number
of motion events.
If the motion event causes an action procedure to be invoked,
the procedure is invoked after each motion event.
</p></li><li class="listitem"><p>
If an event sequence consists of a sequence of events that is also a
noninitial subsequence of another translation,
it is not taken if it occurs in the context of the longer sequence.
This occurs mostly in sequences like the following:
</p><div class="literallayout"><p><br />
<Btn1Down>,<Btn1Up> : toves()\n\<br />
<Btn1Up> : did()<br />
</p></div><p>
The second translation is taken only if the button release is not
preceded by a button press or if there are intervening events between the
press and the release.
Be particularly aware of this when using the repeat notation, above,
with buttons and keys,
because their expansion includes additional events;
and when specifying motion events, because they are implicitly included
between any two other events.
In particular,
pointer motion and double-click translations cannot coexist in the same
translation table.
</p></li><li class="listitem"><p>
For single click on Button1 Up with Shift and Meta, use this specification:
</p></li><li class="listitem"><div class="literallayout"><p><br />
Shift Meta <Btn1Down>, Shift Meta<Btn1Up>: gyre()<br />
</p></div></li><li class="listitem"><p>
For multiple clicks greater or equal to a minimum number,
a plus sign (+) may be appended to the final (rightmost)
count in an event sequence. The actions will be invoked
on the <span class="emphasis"><em>count</em></span>-th click and each subsequent one arriving
within the multi-click time interval. For example:
</p><div class="literallayout"><p><br />
Shift <Btn1Up>(2+) : and()<br />
</p></div></li><li class="listitem"><p>
To indicate
<code class="function">EnterNotify</code>
with any modifiers, use this specification:
</p><div class="literallayout"><p><br />
<Enter> : gimble()<br />
</p></div></li><li class="listitem"><p>
To indicate
<code class="function">EnterNotify</code>
with no modifiers, use this specification:
</p><div class="literallayout"><p><br />
None <Enter> : in()<br />
</p></div></li><li class="listitem"><p>
To indicate
<code class="function">EnterNotify</code>
with Button1 Down and Button2 Up and "don't care" about
the other modifiers, use this specification:
</p><div class="literallayout"><p><br />
Button1 ~Button2 <Enter> : the()<br />
</p></div></li><li class="listitem"><p>
To indicate
<code class="function">EnterNotify</code>
with Button1 down and Button2 down exclusively, use this specification:
</p><div class="literallayout"><p><br />
! Button1 Button2 <Enter> : wabe()<br />
</p></div><p>
You do not need to use a tilde (~) with an exclamation point (!).
</p></li></ul></div></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="Compability_Functions"></a>Appendix C. Compatibility Functions
<a href="#ftn.idp50972768" class="footnote" id="idp50972768"><sup class="footnote">[1]</sup></a>
</h1></div></div></div><p>
In prototype versions of the X Toolkit
each widget class
implemented an Xt<<span class="emphasis"><em>Widget</em></span>>Create (for example,
<code class="function">XtLabelCreate</code>)
function, in which most of the code was identical from widget to widget.
In the Intrinsics, a single generic
<a class="xref" href="#XtCreateWidget"><code class="function">XtCreateWidget</code></a>
performs most of the common work and then calls the initialize procedure
implemented for the particular widget class.
</p><p>
Each Composite class also implemented the procedures
Xt<<span class="emphasis"><em>Widget</em></span>>Add and an Xt<<span class="emphasis"><em>Widget</em></span>>Delete (for example,
<code class="function">XtButtonBoxAddButton</code>
and
<code class="function">XtButtonBoxDeleteButton</code>).
In the Intrinsics, the Composite generic procedures
<a class="xref" href="#XtManageChildren"><code class="function">XtManageChildren</code></a>
and
<a class="xref" href="#XtUnmanageChildren"><code class="function">XtUnmanageChildren</code></a>
perform error checking and screening out of certain children.
Then they call the change_managed procedure
implemented for the widget's Composite class.
If the widget's parent has not yet been realized,
the call to the change_managed procedure is delayed until realization time.
</p><p>
Old-style calls can be implemented in the X Toolkit by defining
one-line procedures or macros that invoke a generic routine. For example,
you could define the macro
<code class="function">XtLabelCreate</code>
as:
</p><div class="literallayout"><p><br />
#define XtLabelCreate(name, parent, args, num_args) \<br />
((LabelWidget) XtCreateWidget(name, labelWidgetClass, parent, args, num_args))<br />
</p></div><p>
Pop-up shells in some of the prototypes automatically performed an
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>
on their child within their insert_child procedure.
Creators of pop-up children need to call
<a class="xref" href="#XtManageChild"><code class="function">XtManageChild</code></a>
themselves.
</p><p>
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>
and
<a class="xref" href="#XtVaAppInitialize"><code class="function">XtVaAppInitialize</code></a>
have been replaced by
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>
and
<a class="xref" href="#XtVaOpenApplication"><code class="function">XtVaOpenApplication</code></a>.
</p><p>
To initialize the Intrinsics internals, create an application context,
open and initialize a display, and create the initial application shell
instance, an application may use
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>
or
<a class="xref" href="#XtVaAppInitialize"><code class="function">XtVaAppInitialize</code></a>.
</p><div class="funcsynopsis"><a id="XtAppInitialize"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtAppInitialize</strong>(</code>XtAppContext *<var class="pdparam">app_context_return</var>, String <var class="pdparam">application_class</var>, XrmOptionDescList <var class="pdparam">options</var>, Cardinal <var class="pdparam">num_options</var>, int *<var class="pdparam">argc_in_out</var>, String *<var class="pdparam">argv_in_out</var>, String *<var class="pdparam">fallback_resources</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context_return</em></span>
</span></p></td><td><p>
Returns the application context, if non-NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the class name of the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>options</em></span>
</span></p></td><td><p>
Specifies the command line options table.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_options</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>options</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argc_in_out</em></span>
</span></p></td><td><p>
Specifies a pointer to the number of command line arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argv_in_out</em></span>
</span></p></td><td><p>
Specifies a pointer to the command line arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>fallback_resources</em></span>
</span></p></td><td><p>
Specifies resource values to be used if the application class resource
file cannot be opened or read, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any
other resource specifications for the created shell widget.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in the argument list.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>
function calls
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>
followed by
<a class="xref" href="#XtCreateApplicationContext"><code class="function">XtCreateApplicationContext</code></a>,
then calls
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
with <span class="emphasis"><em>display_string</em></span> NULL and
<span class="emphasis"><em>application_name</em></span> NULL, and finally calls
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
with <span class="emphasis"><em>application_name</em></span> NULL, <span class="emphasis"><em>widget_class</em></span>
<code class="function">application\%Shell\%Widget\%Class</code>,
and the specified <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span>
and returns the created shell. The modified <span class="emphasis"><em>argc</em></span> and <span class="emphasis"><em>argv</em></span> returned by
<a class="xref" href="#XtDisplayInitialize"><code class="function">XtDisplayInitialize</code></a>
are returned in <span class="emphasis"><em>argc_in_out</em></span> and <span class="emphasis"><em>argv_in_out</em></span>. If
<span class="emphasis"><em>app_context_return</em></span> is not NULL, the created application context is
also returned. If the display specified by the command line cannot be
opened, an error message is issued and
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>
terminates the application. If <span class="emphasis"><em>fallback_resources</em></span> is non-NULL,
<a class="xref" href="#XtAppSetFallbackResources"><code class="function">XtAppSetFallbackResources</code></a>
is called with the value prior to calling
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>.
</p><div class="funcsynopsis"><a id="XtVaAppInitialize"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtVaAppInitialize</strong>(</code>XtAppContext *<var class="pdparam">app_context_return</var>, String <var class="pdparam">application_class</var>, XrmOptionDescList <var class="pdparam">options</var>, Cardinal <var class="pdparam">num_options</var>, int *<var class="pdparam">argc_in_out</var>, String *<var class="pdparam">argv_in_out</var>, String *<var class="pdparam">fallback_resources</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context_return</em></span>
</span></p></td><td><p>
Returns the application context, if non-NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the class name of the application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>options</em></span>
</span></p></td><td><p>
Specifies the command line options table.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_options</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>options</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argc_in_out</em></span>
</span></p></td><td><p>
Specifies a pointer to the number of command line arguments.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argv_in_out</em></span>
</span></p></td><td><p>
Specifies the command line arguments array.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>fallback_resources</em></span>
</span></p></td><td><p>
Specifies resource values to be used if the application class
resource file cannot be opened, or NULL.
</p></td></tr><tr><td><p><span class="term">
...
</span></p></td><td><p>
Specifies the variable argument list to override any other
resource specifications for the created shell.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtVaAppInitialize"><code class="function">XtVaAppInitialize</code></a>
procedure is identical in function to
<a class="xref" href="#XtAppInitialize"><code class="function">XtAppInitialize</code></a>
with the <span class="emphasis"><em>args</em></span> and <span class="emphasis"><em>num_args</em></span> parameters replaced by a varargs list,
as described
in Section 2.5.1.
</p><p>
As a convenience to people converting from earlier versions of the toolkit
without application contexts, the following routines exist:
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>,
<a class="xref" href="#XtMainLoop"><code class="function">XtMainLoop</code></a>,
<a class="xref" href="#XtNextEvent"><code class="function">XtNextEvent</code></a>,
<a class="xref" href="#XtProcessEvent"><code class="function">XtProcessEvent</code></a>,
<a class="xref" href="#XtPeekEvent"><code class="function">XtPeekEvent</code></a>,
<a class="xref" href="#XtPending"><code class="function">XtPending</code></a>,
<a class="xref" href="#XtAddInput"><code class="function">XtAddInput</code></a>,
<a class="xref" href="#XtAddTimeOut"><code class="function">XtAddTimeOut</code></a>,
<a class="xref" href="#XtAddWorkProc"><code class="function">XtAddWorkProc</code></a>,
<a class="xref" href="#XtCreateApplicationShell"><code class="function">XtCreateApplicationShell</code></a>,
<a class="xref" href="#XtAddActions"><code class="function">XtAddActions</code></a>,
<a class="xref" href="#XtSetSelectionTimeout"><code class="function">XtSetSelectionTimeout</code></a>,
and
<a class="xref" href="#XtGetSelectionTimeout"><code class="function">XtGetSelectionTimeout</code></a>.
</p><div class="funcsynopsis"><a id="XtInitialize"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtInitialize</strong>(</code>String <var class="pdparam">shell_name</var>, String <var class="pdparam">application_class</var>, XrmOptionDescRec <var class="pdparam">options</var>, Cardinal <var class="pdparam">num_options</var>, int *<var class="pdparam">argc</var>, String <var class="pdparam">argv</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>shell_name</em></span>
</span></p></td><td><p>
This parameter is ignored; therefore, you can specify NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>application_class</em></span>
</span></p></td><td><p>
Specifies the class name of this application.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>options</em></span>
</span></p></td><td><p>
Specifies how to parse the command line for any application-specific resources.
The <span class="emphasis"><em>options</em></span> argument is passed as a parameter to
<code class="function">XrmParseCommand</code>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_options</em></span>
</span></p></td><td><p>
Specifies the number of entries in the options list.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argc</em></span>
</span></p></td><td><p>
Specifies a pointer to the number of command line parameters.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>argv</em></span>
</span></p></td><td><p>
Specifies the command line parameters.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
calls
<a class="xref" href="#XtToolkitInitialize"><code class="function">XtToolkitInitialize</code></a>
to initialize the toolkit internals,
creates a default application context for use by the other convenience
routines, calls
<a class="xref" href="#XtOpenDisplay"><code class="function">*XtOpenDisplay</code></a>
with <span class="emphasis"><em>display_string</em></span> NULL and <span class="emphasis"><em>application_name</em></span> NULL, and
finally calls
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
with <span class="emphasis"><em>application_name</em></span> NULL and
returns the created shell.
The semantics of calling
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
more than once are undefined.
This routine has been replaced by
<a class="xref" href="#XtOpenApplication"><code class="function">XtOpenApplication</code></a>.
</p><div class="funcsynopsis"><a id="XtMainLoop"></a><p><code class="funcdef">void <strong class="fsfunc">XtMainLoop</strong>(</code><var class="pdparam">void</var><code>)</code>;</p></div><p>
<a class="xref" href="#XtMainLoop"><code class="function">XtMainLoop</code></a>
first reads the next alternate input, timer, or X event by calling
<a class="xref" href="#XtNextEvent"><code class="function">XtNextEvent</code></a>.
Then it dispatches this to the appropriate registered procedure by calling
<a class="xref" href="#XtDispatchEvent"><code class="function">XtDispatchEvent</code></a>.
This routine has been replaced by
<a class="xref" href="#XtAppMainLoop"><code class="function">XtAppMainLoop</code></a>.
</p><div class="funcsynopsis"><a id="XtNextEvent"></a><p><code class="funcdef">void <strong class="fsfunc">XtNextEvent</strong>(</code>XEvent *<var class="pdparam">event_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>event_return</em></span>
</span></p></td><td><p>
Returns the event information to the specified event structure.
</p></td></tr></tbody></table></div><p>
If no input is on the X input queue for the default application context,
<a class="xref" href="#XtNextEvent"><code class="function">XtNextEvent</code></a>
flushes the X output buffer
and waits for an event while looking at the alternate input sources
and timeout values and calling any callback procedures triggered by them.
This routine has been replaced by
<a class="xref" href="#XtAppNextEvent"><code class="function">XtAppNextEvent</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><div class="funcsynopsis"><a id="XtProcessEvent"></a><p><code class="funcdef">void <strong class="fsfunc">XtProcessEvent</strong>(</code>XtInputMask <var class="pdparam">mask</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>mask</em></span>
</span></p></td><td><p>
Specifies the type of input to process.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtProcessEvent"><code class="function">XtProcessEvent</code></a>
processes one X event, timeout, or alternate input source
(depending on the value of <span class="emphasis"><em>mask</em></span>), blocking if necessary.
It has been replaced by
<a class="xref" href="#XtAppProcessEvent"><code class="function">XtAppProcessEvent</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this function.
</p><div class="funcsynopsis"><a id="XtPeekEvent"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtPeekEvent</strong>(</code>XEvent *<var class="pdparam">event_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>event_return</em></span>
</span></p></td><td><p>
Returns the event information to the specified event structure.
</p></td></tr></tbody></table></div><p>
If there is an event in the queue for the default application context,
<a class="xref" href="#XtPeekEvent"><code class="function">XtPeekEvent</code></a>
fills in the event and returns a nonzero value.
If no X input is on the queue,
<a class="xref" href="#XtPeekEvent"><code class="function">XtPeekEvent</code></a>
flushes the output buffer and blocks until input is available, possibly
calling some timeout callbacks in the process.
If the input is an event,
<a class="xref" href="#XtPeekEvent"><code class="function">XtPeekEvent</code></a>
fills in the event and returns a nonzero value.
Otherwise, the input is for an alternate input source, and
<a class="xref" href="#XtPeekEvent"><code class="function">XtPeekEvent</code></a>
returns zero.
This routine has been replaced by
<a class="xref" href="#XtAppPeekEvent"><code class="function">XtAppPeekEvent</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><div class="funcsynopsis"><a id="XtPending"></a><p><code class="funcdef">Boolean <strong class="fsfunc">XtPending</strong>(</code><var class="pdparam"></var><code>)</code>;</p></div><p>
<a class="xref" href="#XtPending"><code class="function">XtPending</code></a>
returns a nonzero value if there are
events pending from the X server or alternate input sources in the default
application context.
If there are no events pending,
it flushes the output buffer and returns a zero value.
It has been replaced by
<a class="xref" href="#XtAppPending"><code class="function">XtAppPending</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><div class="funcsynopsis"><a id="XtAddInput"></a><p><code class="funcdef">XtInputId <strong class="fsfunc">XtAddInput</strong>(</code>int <var class="pdparam">source</var>, XtPointer <var class="pdparam">condition</var>, XtInputCallbackProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>source</em></span>
</span></p></td><td><p>
Specifies the source file descriptor on a POSIX-based system
or other operating-system-dependent device specification.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>condition</em></span>
</span></p></td><td><p>
Specifies the mask that indicates either a read, write, or exception condition
or some operating-system-dependent condition.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure called when input is available.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the parameter to be passed to <span class="emphasis"><em>proc</em></span> when input is available.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAddInput"><code class="function">XtAddInput</code></a>
function registers in the default application context a new
source of events,
which is usually file input but can also be file output.
(The word <span class="emphasis"><em>file</em></span> should be loosely interpreted to mean any sink
or source of data.)
<a class="xref" href="#XtAddInput"><code class="function">XtAddInput</code></a>
also specifies the conditions under which the source can generate events.
When input is pending on this source in the default application context,
the callback procedure is called.
This routine has been replaced by
<a class="xref" href="#XtAppAddInput"><code class="function">XtAppAddInput</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><div class="funcsynopsis"><a id="XtAddTimeOut"></a><p><code class="funcdef">XtIntervalId <strong class="fsfunc">XtAddTimeOut</strong>(</code>unsigned long <var class="pdparam">interval</var>, XtTimerCallbackProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>interval</em></span>
</span></p></td><td><p>
Specifies the time interval in milliseconds.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Specifies the procedure to be called when time expires.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Specifies the parameter to be passed to <span class="emphasis"><em>proc</em></span> when it is called.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtAddTimeOut"><code class="function">XtAddTimeOut</code></a>
function creates a timeout in the default application context
and returns an identifier for it.
The timeout value is set to <span class="emphasis"><em>interval</em></span>.
The callback procedure will be called after
the time interval elapses, after which the timeout is removed.
This routine has been replaced by
<a class="xref" href="#XtAppAddTimeOut"><code class="function">XtAppAddTimeOut</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><div class="funcsynopsis"><a id="XtAddWorkProc"></a><p><code class="funcdef">XtWorkProcId <strong class="fsfunc">XtAddWorkProc</strong>(</code>XtWorkProc <var class="pdparam">proc</var>, XtPointer <var class="pdparam">client_data</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>proc</em></span>
</span></p></td><td><p>
Procedure to call to do the work.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>client_data</em></span>
</span></p></td><td><p>
Client data to pass to <span class="emphasis"><em>proc</em></span> when it is called.
</p></td></tr></tbody></table></div><p>
This routine registers a work procedure in the default application context. It has
been replaced by
<a class="xref" href="#XtAppAddWorkProc"><code class="function">XtAppAddWorkProc</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><div class="funcsynopsis"><a id="XtCreateApplicationShell"></a><p><code class="funcdef">Widget <strong class="fsfunc">XtCreateApplicationShell</strong>(</code>String <var class="pdparam">name</var>, WidgetClass <var class="pdparam">widget_class</var>, ArgList <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
This parameter is ignored; therefore, you can specify NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>widget_class</em></span>
</span></p></td><td><p>
Specifies the widget class pointer for the created application shell widget.
This will usually be
<code class="function">topLevelShellWidgetClass</code>
or a subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list to override any other resource specifications.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>args</em></span>.
</p></td></tr></tbody></table></div><p>
The procedure
<a class="xref" href="#XtCreateApplicationShell"><code class="function">XtCreateApplicationShell</code></a>
calls
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>
with <span class="emphasis"><em>application_name</em></span> NULL, the application class passed to
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>,
and the default application context created by
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>.
This routine has been replaced by
<a class="xref" href="#XtAppCreateShell"><code class="function">XtAppCreateShell</code></a>.
</p><p>
An old-format resource type converter procedure pointer is of type
<a class="xref" href="#XtConverter"><code class="function">(*XtConverter)</code></a>.
</p><div class="funcsynopsis"><a id="XtConverter"></a><p><code class="funcdef">typedef void <strong class="fsfunc">(*XtConverter)</strong>(</code>XrmValue *<var class="pdparam">args</var>, Cardinal *<var class="pdparam">num_args</var>, XrmValue *<var class="pdparam">from</var>, XrmValue *<var class="pdparam">to</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies a list of additional
<code class="function">XrmValue</code>
arguments to the converter if additional context is needed
to perform the conversion, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>args</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from</em></span>
</span></p></td><td><p>
Specifies the value to convert.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to</em></span>
</span></p></td><td><p>
Specifies the descriptor to use to return the converted value.
</p></td></tr></tbody></table></div><p>
Type converters should perform the following actions:
</p><div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; "><li class="listitem"><p>
Check to see that the number of arguments passed is correct.
</p></li><li class="listitem"><p>
Attempt the type conversion.
</p></li><li class="listitem"><p>
If successful, return the size and pointer to the data in the <span class="emphasis"><em>to</em></span> argument;
otherwise, call
<a class="xref" href="#XtWarningMsg"><code class="function">XtWarningMsg</code></a>
and return without modifying the <span class="emphasis"><em>to</em></span> argument.
</p></li></ul></div><p>
Most type converters just take the data described by the specified <span class="emphasis"><em>from</em></span>
argument and return data by writing into the specified <span class="emphasis"><em>to</em></span> argument.
A few need other information, which is available in the specified
argument list.
A type converter can invoke another type converter,
which allows differing sources that may convert into a common intermediate
result to make maximum use of the type converter cache.
</p><p>
Note that the address returned in <span class="emphasis"><em>to->addr</em></span> cannot be that of a local variable of
the converter because this is not valid after the converter returns.
It should be a pointer to a static variable.
</p><p>
The procedure type
<a class="xref" href="#XtConverter"><code class="function">(*XtConverter)</code></a>
has been replaced by
<a class="xref" href="#XtTypeConverter"><code class="function">(*XtTypeConverter)</code></a>.
</p><p>
The
<a class="xref" href="#XtStringConversionWarning"><code class="function">XtStringConversionWarning</code></a>
function is a convenience routine for old-format resource converters
that convert from strings.
</p><div class="funcsynopsis"><a id="XtStringConversionWarning"></a><p><code class="funcdef">void <strong class="fsfunc">XtStringConversionWarning</strong>(</code>String <var class="pdparam">src</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>src</em></span>
</span></p></td><td><p>
Specifies the string that could not be converted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>dst_type</em></span>
</span></p></td><td><p>
Specifies the name of the type to which the string could not be converted.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtStringConversionWarning"><code class="function">XtStringConversionWarning</code></a>
function issues a warning message with name "conversionError",
type "string", class "XtToolkitError, and the default message string
"Cannot convert "<span class="emphasis"><em>src</em></span>" to type <span class="emphasis"><em>dst_type</em></span>". This routine
has been superseded by
<a class="xref" href="#XtDisplayStringConversionWarning"><code class="function">XtDisplayStringConversionWarning</code></a>.
</p><p>
To register an old-format converter, use
<a class="xref" href="#XtAddConverter"><code class="function">XtAddConverter</code></a>
or
<a class="xref" href="#XtAppAddConverter"><code class="function">XtAppAddConverter</code></a>.
</p><div class="funcsynopsis"><a id="XtAddConverter"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddConverter</strong>(</code>String <var class="pdparam">from_type</var>, String <var class="pdparam">to_type</var>, XtConverter <var class="pdparam">converter</var>, XtConvertArgList <var class="pdparam">convert_args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>from_type</em></span>
</span></p></td><td><p>
Specifies the source type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_type</em></span>
</span></p></td><td><p>
Specifies the destination type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter</em></span>
</span></p></td><td><p>
Specifies the type converter procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>convert_args</em></span>
</span></p></td><td><p>
Specifies how to compute the additional arguments to the converter, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>convert_args</em></span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAddConverter"><code class="function">XtAddConverter</code></a>
is equivalent in function to
<a class="xref" href="#XtSetTypeConverter"><code class="function">XtSetTypeConverter</code></a>
with <span class="emphasis"><em>cache_type</em></span> equal to
<code class="function">XtCacheAll</code>
for old-format type converters. It has been superseded by
<a class="xref" href="#XtSetTypeConverter"><code class="function">XtSetTypeConverter</code></a>.
</p><div class="funcsynopsis"><a id="XtAppAddConverter"></a><p><code class="funcdef">void <strong class="fsfunc">XtAppAddConverter</strong>(</code>XtAppContext <var class="pdparam">app_context</var>, String <var class="pdparam">from_type</var>, String <var class="pdparam">to_type</var>, XtConverter <var class="pdparam">converter</var>, XtConvertArgList <var class="pdparam">convert_args</var>, Cardinal <var class="pdparam">num_args</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>app_context</em></span>
</span></p></td><td><p>
Specifies the application context.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from_type</em></span>
</span></p></td><td><p>
Specifies the source type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_type</em></span>
</span></p></td><td><p>
Specifies the destination type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>converter</em></span>
</span></p></td><td><p>
Specifies the type converter procedure.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>convert_args</em></span>
</span></p></td><td><p>
Specifies how to compute the additional arguments to the converter, or NULL.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>convert_args</em></span>.
</p></td></tr></tbody></table></div><p>
<a class="xref" href="#XtAppAddConverter"><code class="function">XtAppAddConverter</code></a>
is equivalent in function to
<a class="xref" href="#XtAppSetTypeConverter"><code class="function">XtAppSetTypeConverter</code></a>
with <span class="emphasis"><em>cache_type</em></span> equal to
<code class="function">XtCacheAll</code>
for old-format type converters. It has been superseded by
<a class="xref" href="#XtAppSetTypeConverter"><code class="function">XtAppSetTypeConverter</code></a>.
</p><p>
To invoke resource conversions, a client may use
<a class="xref" href="#XtConvert"><code class="function">XtConvert</code></a>
or, for old-format converters only,
<a class="xref" href="#XtDirectConvert"><code class="function">XtDirectConvert</code></a>.
</p><div class="funcsynopsis"><a id="XtConvert"></a><p><code class="funcdef">void <strong class="fsfunc">XtConvert</strong>(</code>Widget <var class="pdparam">w</var>, String <var class="pdparam">from_type</var>, XrmValuePtr <var class="pdparam">from</var>, String <var class="pdparam">to_type</var>, XrmValuePtr <var class="pdparam">to_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies the widget to use for additional arguments, if any are
needed.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from_type</em></span>
</span></p></td><td><p>
Specifies the source type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from</em></span>
</span></p></td><td><p>
Specifies the value to be converted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_type</em></span>
</span></p></td><td><p>
Specifies the destination type.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_return</em></span>
</span></p></td><td><p>
Returns the converted value.
</p></td></tr></tbody></table></div><div class="funcsynopsis"><a id="XtDirectConvert"></a><p><code class="funcdef">void <strong class="fsfunc">XtDirectConvert</strong>(</code>XtConverter <var class="pdparam">converter</var>, XrmValuePtr <var class="pdparam">args</var>, Cardinal <var class="pdparam">num_args</var>, XrmValuePtr <var class="pdparam">from</var>, XrmValuePtr <var class="pdparam">to_return</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>converter</em></span>
</span></p></td><td><p>
Specifies the conversion procedure to be called.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>args</em></span>
</span></p></td><td><p>
Specifies the argument list that contains the additional arguments
needed to perform the conversion (often NULL).
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_args</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>args</em></span>.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>from</em></span>
</span></p></td><td><p>
Specifies the value to be converted.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>to_return</em></span>
</span></p></td><td><p>
Returns the converted value.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtConvert"><code class="function">XtConvert</code></a>
function looks up the type converter registered to convert <span class="emphasis"><em>from_type</em></span>
to <span class="emphasis"><em>to_type</em></span>, computes any additional arguments needed, and then calls
<a class="xref" href="#XtDirectConvert"><code class="function">XtDirectConvert</code></a>
or
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>.
The
<a class="xref" href="#XtDirectConvert"><code class="function">XtDirectConvert</code></a>
function looks in the converter cache to see if this conversion procedure
has been called with the specified arguments.
If so, it returns a descriptor for information stored in the cache;
otherwise, it calls the converter and enters the result in the cache.
</p><p>
Before calling the specified converter,
<a class="xref" href="#XtDirectConvert"><code class="function">XtDirectConvert</code></a>
sets the return value size to zero and the return value address to NULL.
To determine if the conversion was successful,
the client should check <span class="emphasis"><em>to_return.addr</em></span> for non-NULL.
The data returned by
<a class="xref" href="#XtConvert"><code class="function">XtConvert</code></a>
must be copied immediately by the caller,
as it may point to static data in the type converter.
</p><p>
<a class="xref" href="#XtConvert"><code class="function">XtConvert</code></a>
has been replaced by
<a class="xref" href="#XtConvertAndStore"><code class="function">XtConvertAndStore</code></a>,
and
<a class="xref" href="#XtDirectConvert"><code class="function">XtDirectConvert</code></a>
has been superseded by
<a class="xref" href="#XtCallConverter"><code class="function">XtCallConverter</code></a>.
</p><p>
To deallocate a shared GC when it is no longer needed, use
<a class="xref" href="#XtDestroyGC"><code class="function">XtDestroyGC</code></a>.
</p><div class="funcsynopsis"><a id="XtDestroyGC"></a><p><code class="funcdef">void <strong class="fsfunc">XtDestroyGC</strong>(</code>Widget <var class="pdparam">w</var>, GC <var class="pdparam">gc</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>w</em></span>
</span></p></td><td><p>
Specifies any object on the display for which the shared GC was
created. Must be of class Object or any subclass thereof.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>gc</em></span>
</span></p></td><td><p>
Specifies the shared GC to be deallocated.
</p></td></tr></tbody></table></div><p>
References to sharable GCs are counted and a free request is generated to the
server when the last user of a given GC destroys it.
Note that some earlier versions of
<a class="xref" href="#XtDestroyGC"><code class="function">XtDestroyGC</code></a>
had only a <span class="emphasis"><em>gc</em></span> argument.
Therefore, this function is not very portable,
and you are encouraged to use
<a class="xref" href="#XtReleaseGC"><code class="function">XtReleaseGC</code></a>
instead.
</p><p>
To declare an action table in the default application context
and register it with the translation manager, use
<a class="xref" href="#XtAddActions"><code class="function">XtAddActions</code></a>.
</p><div class="funcsynopsis"><a id="XtAddActions"></a><p><code class="funcdef">void <strong class="fsfunc">XtAddActions</strong>(</code>XtActionList <var class="pdparam">actions</var>, Cardinal <var class="pdparam">num_actions</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>actions</em></span>
</span></p></td><td><p>
Specifies the action table to register.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_actions</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>actions</em></span>.
</p></td></tr></tbody></table></div><p>
If more than one action is registered with the same name,
the most recently registered action is used.
If duplicate actions exist in an action table,
the first is used.
The Intrinsics register an action table for
<a class="xref" href="#XtMenuPopup"><code class="function">XtMenuPopup</code></a>
and
<a class="xref" href="#XtMenuPopdown"><code class="function">XtMenuPopdown</code></a>
as part of X Toolkit initialization.
This routine has been replaced by
<a class="xref" href="#XtAppAddActions"><code class="function">XtAppAddActions</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><p>
To set the Intrinsics selection timeout in the default application context, use
<a class="xref" href="#XtSetSelectionTimeout"><code class="function">XtSetSelectionTimeout</code></a>.
</p><div class="funcsynopsis"><a id="XtSetSelectionTimeout"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetSelectionTimeout</strong>(</code>unsigned long <var class="pdparam">timeout</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>timeout</em></span>
</span></p></td><td><p>
Specifies the selection timeout in milliseconds.
This routine has been replaced by
<a class="xref" href="#XtAppSetSelectionTimeout"><code class="function">XtAppSetSelectionTimeout</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p></td></tr></tbody></table></div><p>
To get the current selection timeout value in the default application
context, use
<a class="xref" href="#XtGetSelectionTimeout"><code class="function">XtGetSelectionTimeout</code></a>.
</p><div class="funcsynopsis"><a id="XtGetSelectionTimeout"></a><p><code class="funcdef">unsigned long <strong class="fsfunc">XtGetSelectionTimeout</strong>(</code><var class="pdparam"></var><code>)</code>;</p></div><p>
The selection timeout is the time within which the two communicating
applications must respond to one another.
If one of them does not respond within this interval,
the Intrinsics abort the selection request.
</p><p>
This routine has been replaced by
<a class="xref" href="#XtAppGetSelectionTimeout"><code class="function">XtAppGetSelectionTimeout</code></a>.
<a class="xref" href="#XtInitialize"><code class="function">XtInitialize</code></a>
must be called before using this routine.
</p><p>
To obtain the global error database (for example, to merge with
an application- or widget-specific database), use
<a class="xref" href="#XtGetErrorDatabase"><code class="function">*XtGetErrorDatabase</code></a>.
</p><div class="funcsynopsis"><a id="XtGetErrorDatabase"></a><p><code class="funcdef">XrmDatabase <strong class="fsfunc">*XtGetErrorDatabase</strong>(</code><var class="pdparam"></var><code>)</code>;</p></div><p>
The
<a class="xref" href="#XtGetErrorDatabase"><code class="function">*XtGetErrorDatabase</code></a>
function returns the address of the error database.
The Intrinsics do a lazy binding of the error database and do not merge in the
database file until the first call to
<code class="function">XtGetErrorDatbaseText</code>.
This routine has been replaced by
<a class="xref" href="#XtAppGetErrorDatabase"><code class="function">XtAppGetErrorDatabase</code></a>.
</p><p>
An error message handler can obtain the error database text for an
error or a warning by calling
<a class="xref" href="#XtGetErrorDatabaseText"><code class="function">XtGetErrorDatabaseText</code></a>.
</p><div class="funcsynopsis"><a id="XtGetErrorDatabaseText"></a><p><code class="funcdef">void <strong class="fsfunc">XtGetErrorDatabaseText</strong>(</code>String <var class="pdparam">name</var>, String <var class="pdparam">default</var>, String <var class="pdparam">buffer_return</var>, int <var class="pdparam">nbytes</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p></p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specify the name and type that are concatenated to form the resource name
of the error message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the resource class of the error message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>default</em></span>
</span></p></td><td><p>
Specifies the default message to use if an error database entry is not found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>buffer_return</em></span>
</span></p></td><td><p>
Specifies the buffer into which the error message is to be returned.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>nbytes</em></span>
</span></p></td><td><p>
Specifies the size of the buffer in bytes.
</p></td></tr></tbody></table></div><p>
The
<a class="xref" href="#XtGetErrorDatabaseText"><code class="function">XtGetErrorDatabaseText</code></a>
returns the appropriate message from the error database
associated with the default application context
or returns the specified default message if one is not found in the
error database.
To form the full resource name and class when querying the database,
the <span class="emphasis"><em>name</em></span> and <span class="emphasis"><em>type</em></span> are concatenated with a single "."
between them and the <span class="emphasis"><em>class</em></span> is concatenated with itself with a
single "." if it does not already contain a ".".
This routine has been superseded by
<a class="xref" href="#XtAppGetErrorDatabaseText"><code class="function">XtAppGetErrorDatabaseText</code></a>.
</p><p>
To register a procedure to be called on fatal error conditions, use
<a class="xref" href="#XtSetErrorMsgHandler"><code class="function">XtSetErrorMsgHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtSetErrorMsgHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetErrorMsgHandler</strong>(</code>XtErrorMsgHandler <var class="pdparam">msg_handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>msg_handler</em></span>
</span></p></td><td><p>
Specifies the new fatal error procedure, which should not return.
</p></td></tr></tbody></table></div><p>
The default error handler provided by the Intrinsics constructs a
string from the error resource database and calls
<a class="xref" href="#XtError"><code class="function">XtError</code></a>.
Fatal error message handlers should not return.
If one does,
subsequent Intrinsics behavior is undefined.
This routine has been superseded by
<a class="xref" href="#XtAppSetErrorMsgHandler"><code class="function">XtAppSetErrorMsgHandler</code></a>.
</p><p>
To call the high-level error handler, use
<a class="xref" href="#XtErrorMsg"><code class="function">XtErrorMsg</code></a>.
</p><div class="funcsynopsis"><a id="XtErrorMsg"></a><p><code class="funcdef">void <strong class="fsfunc">XtErrorMsg</strong>(</code>String <var class="pdparam">name</var>, String <var class="pdparam">type</var>, String <var class="pdparam">class</var>, String <var class="pdparam">default</var>, String *<var class="pdparam">params</var>, Cardinal *<var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the general kind of error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the detailed name of the error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the resource class.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>default</em></span>
</span></p></td><td><p>
Specifies the default message to use if an error database entry is not found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies a pointer to a list of values to be stored in the message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><p>
This routine has been superseded by
<a class="xref" href="#XtAppErrorMsg"><code class="function">XtAppErrorMsg</code></a>.
</p><p>
To register a procedure to be called on nonfatal error conditions, use
<a class="xref" href="#XtSetWarningMsgHandler"><code class="function">XtSetWarningMsgHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtSetWarningMsgHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetWarningMsgHandler</strong>(</code>XtErrorMsgHandler <var class="pdparam">msg_handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>msg_handler</em></span>
</span></p></td><td><p>
Specifies the new nonfatal error procedure, which usually returns.
</p></td></tr></tbody></table></div><p>
The default warning handler provided by the Intrinsics constructs a string
from the error resource database and calls
<a class="xref" href="#XtWarning"><code class="function">XtWarning</code></a>.
This routine has been superseded by
<a class="xref" href="#XtAppSetWarningMsgHandler"><code class="function">XtAppSetWarningMsgHandler</code></a>.
</p><p>
To call the installed high-level warning handler, use
<a class="xref" href="#XtWarningMsg"><code class="function">XtWarningMsg</code></a>.
</p><div class="funcsynopsis"><a id="XtWarningMsg"></a><p><code class="funcdef">void <strong class="fsfunc">XtWarningMsg</strong>(</code>String <var class="pdparam">name</var>, String <var class="pdparam">type</var>, String <var class="pdparam">class</var>, String <var class="pdparam">default</var>, String *<var class="pdparam">params</var>, Cardinal *<var class="pdparam">num_params</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>name</em></span>
</span></p></td><td><p>
Specifies the general kind of error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>type</em></span>
</span></p></td><td><p>
Specifies the detailed name of the error.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>class</em></span>
</span></p></td><td><p>
Specifies the resource class.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>default</em></span>
</span></p></td><td><p>
Specifies the default message to use if an error database entry is not found.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>params</em></span>
</span></p></td><td><p>
Specifies a pointer to a list of values to be stored in the message.
</p></td></tr><tr><td><p><span class="term">
<span class="emphasis"><em>num_params</em></span>
</span></p></td><td><p>
Specifies the number of entries in <span class="emphasis"><em>params</em></span>.
</p></td></tr></tbody></table></div><p>
This routine has been superseded by
<a class="xref" href="#XtAppWarningMsg"><code class="function">XtAppWarningMsg</code></a>.
</p><p>
To register a procedure to be called on fatal error conditions, use
<a class="xref" href="#XtSetErrorHandler"><code class="function">XtSetErrorHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtSetErrorHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetErrorHandler</strong>(</code>XtErrorHandler <var class="pdparam">handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>handler</em></span>
</span></p></td><td><p>
Specifies the new fatal error procedure, which should not return.
</p></td></tr></tbody></table></div><p>
The default error handler provided by the Intrinsics is
<code class="function">_XtError</code>.
On POSIX-based systems,
it prints the message to standard error and terminates the application.
Fatal error message handlers should not return.
If one does,
subsequent X Toolkit behavior is undefined.
This routine has been superseded by
<a class="xref" href="#XtAppSetErrorHandler"><code class="function">XtAppSetErrorHandler</code></a>.
</p><p>
To call the installed fatal error procedure, use
<a class="xref" href="#XtError"><code class="function">XtError</code></a>.
</p><div class="funcsynopsis"><a id="XtError"></a><p><code class="funcdef">void <strong class="fsfunc">XtError</strong>(</code>String <var class="pdparam">message</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>message</em></span>
</span></p></td><td><p>
Specifies the message to be reported.
</p></td></tr></tbody></table></div><p>
Most programs should use
<a class="xref" href="#XtAppErrorMsg"><code class="function">XtAppErrorMsg</code></a>,
not
<a class="xref" href="#XtError"><code class="function">XtError</code></a>,
to provide for customization and internationalization of error
messages. This routine has been superseded by
<a class="xref" href="#XtAppError"><code class="function">XtAppError</code></a>.
</p><p>
To register a procedure to be called on nonfatal error conditions, use
<a class="xref" href="#XtSetWarningHandler"><code class="function">XtSetWarningHandler</code></a>.
</p><div class="funcsynopsis"><a id="XtSetWarningHandler"></a><p><code class="funcdef">void <strong class="fsfunc">XtSetWarningHandler</strong>(</code>XtErrorHandler <var class="pdparam">handler</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>handler</em></span>
</span></p></td><td><p>
Specifies the new nonfatal error procedure, which usually returns.
</p></td></tr></tbody></table></div><p>
The default warning handler provided by the Intrinsics is
<code class="function">_XtWarning</code>.
On POSIX-based systems,
it prints the message to standard error and returns to the caller.
This routine has been superseded by
<a class="xref" href="#XtAppSetWarningHandler"><code class="function">XtAppSetWarningHandler</code></a>.
</p><p>
To call the installed nonfatal error procedure, use
<a class="xref" href="#XtWarning"><code class="function">XtWarning</code></a>.
</p><div class="funcsynopsis"><a id="XtWarning"></a><p><code class="funcdef">void <strong class="fsfunc">XtWarning</strong>(</code>String <var class="pdparam">message</var><code>)</code>;</p></div><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">
<span class="emphasis"><em>message</em></span>
</span></p></td><td><p>
Specifies the nonfatal error message to be reported.
</p></td></tr></tbody></table></div><p>
Most programs should use
<a class="xref" href="#XtAppWarningMsg"><code class="function">XtAppWarningMsg</code></a>,
not
<a class="xref" href="#XtWarning"><code class="function">XtWarning</code></a>,
to provide for customization and internationalization of warning messages.
This routine has been superseded by
<a class="xref" href="#XtAppWarning"><code class="function">XtAppWarning</code></a>.
</p><div class="footnotes"><br /><hr style="width:100; text-align:left;margin-left: 0" /><div id="ftn.idp50972768" class="footnote"><p><a href="#idp50972768" class="para"><sup class="para">[1] </sup></a>
This appendix is part of the formal Intrinsics Specification.
</p></div></div></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="Intrinsics_Error_Messages"></a>Appendix D. Intrinsics Error Messages</h1></div></div></div><p>
All Intrinsics errors and warnings have class
``XtToolkitError''.
The following two tables summarize the common errors and warnings that can be
generated by the Intrinsics.
Additional implementation-dependent messages are permitted.
Error Messages
</p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Type</th><th align="left">Default Message</th></tr></thead><tbody><tr><td align="left">allocError</td><td align="left">calloc</td><td align="left">Cannot perform calloc</td></tr><tr><td align="left">allocError</td><td align="left">malloc</td><td align="left">Cannot perform malloc</td></tr><tr><td align="left">allocError</td><td align="left">realloc</td><td align="left">Cannot perform realloc</td></tr><tr><td align="left">internalError</td><td align="left">xtMakeGeometryRequest</td><td align="left">internal error; ShellClassExtension is NULL</td></tr><tr><td align="left">invalidArgCount</td><td align="left">xtGetValues</td><td align="left">Argument count > 0 on NULL argument list in XtGetValues</td></tr><tr><td align="left">invalidArgCount</td><td align="left">xtSetValues</td><td align="left">Argument count > 0 on NULL argument list in XtSetValues</td></tr><tr><td align="left">invalidClass</td><td align="left">applicationShellInsertChild</td><td align="left">ApplicationShell does not accept RectObj children; ignored</td></tr><tr><td align="left">invalidClass</td><td align="left">constraintSetValue</td><td align="left">Subclass of Constraint required in CallConstraintSetValues</td></tr><tr><td align="left">invalidClass</td><td align="left">xtAppCreateShell</td><td align="left">XtAppCreateShell requires non-NULL widget class</td></tr><tr><td align="left">invalidClass</td><td align="left">xtCreatePopupShell</td><td align="left">XtCreatePopupShell requires non-NULL widget class</td></tr><tr><td align="left">invalidClass</td><td align="left">xtCreateWidget</td><td align="left">XtCreateWidget requires non-NULL widget class</td></tr><tr><td align="left">invalidClass</td><td align="left">xtPopdown</td><td align="left">XtPopdown requires a subclass of shellWidgetClass</td></tr><tr><td align="left">invalidClass</td><td align="left">xtPopup</td><td align="left">XtPopup requires a subclass of shellWidgetClass</td></tr><tr><td align="left">invalidDimension</td><td align="left">xtCreateWindow</td><td align="left">Widget %s has zero width and/or height</td></tr><tr><td align="left">invalidDimension</td><td align="left">shellRealize</td><td align="left">Shell widget %s has zero width and/or height</td></tr><tr><td align="left">invalidDisplay</td><td align="left">xtInitialize</td><td align="left">Can't open display: %s</td></tr><tr><td align="left">invalidGetValues</td><td align="left">xtGetValues</td><td align="left">NULL ArgVal in XtGetValues</td></tr><tr><td align="left">invalidExtension</td><td align="left">shellClassPartInitialize</td><td align="left">widget class %s has invalid ShellClassExtension record</td></tr><tr><td align="left">invalidExtension</td><td align="left">xtMakeGeometryRequest</td><td align="left">widget class %s has invalid ShellClassExtension record</td></tr><tr><td align="left">invalidGeometryManager</td><td align="left">xtMakeGeometryRequest</td><td align="left">XtMakeGeometryRequest - parent has no geometry manager</td></tr><tr><td align="left">invalidParameter</td><td align="left">xtAddInput</td><td align="left">invalid condition passed to XtAddInput</td></tr><tr><td align="left">invalidParameter</td><td align="left">xtAddInput</td><td align="left">invalid condition passed to XtAppAddInput</td></tr><tr><td align="left">invalidParent</td><td align="left">xtChangeManagedSet</td><td align="left">Attempt to manage a child when parent is not Composite</td></tr><tr><td align="left">invalidParent</td><td align="left">xtChangeManagedSet</td><td align="left">Attempt to unmanage a child when parent is not Composite</td></tr><tr><td align="left">invalidParent</td><td align="left">xtCreatePopupShell</td><td align="left">XtCreatePopupShell requires non-NULL parent</td></tr><tr><td align="left">invalidParent</td><td align="left">xtCreateWidget</td><td align="left">XtCreateWidget requires non-NULL parent</td></tr><tr><td align="left">invalidParent</td><td align="left">xtMakeGeometryRequest</td><td align="left">non-shell has no parent in XtMakeGeometryRequest</td></tr><tr><td align="left">invalidParent</td><td align="left">xtMakeGeometryRequest</td><td align="left">XtMakeGeometryRequest - parent not composite</td></tr><tr><td align="left">invalidParent</td><td align="left">xtManageChildren</td><td align="left">Attempt to manage a child when parent is not Composite</td></tr><tr><td align="left">invalidParent</td><td align="left">xtUnmanageChildren</td><td align="left">Attempt to unmanage a child when parent is not Composite</td></tr><tr><td align="left">invalidProcedure</td><td align="left">inheritanceProc</td><td align="left">Unresolved inheritance operation</td></tr><tr><td align="left">invalidProcedure</td><td align="left">realizeProc</td><td align="left">No realize class procedure defined</td></tr><tr><td align="left">invalidWindow</td><td align="left">eventHandler</td><td align="left">Event with wrong window</td></tr><tr><td align="left">missingWidget</td><td align="left">fetchDisplayArg</td><td align="left">FetchDisplayArg called without a widget to reference</td></tr><tr><td align="left">nonWidget</td><td align="left">xtCreateWidget</td><td align="left">attempt to add non-widget child "%s" to parent "%s" which supports only widgets</td></tr><tr><td align="left">noPerDisplay</td><td align="left">closeDisplay</td><td align="left">Couldn't find per display information</td></tr><tr><td align="left">noPerDisplay</td><td align="left">getPerDisplay</td><td align="left">Couldn't find per display information</td></tr><tr><td align="left">noSelectionProperties</td><td align="left">freeSelectionProperty</td><td align="left">internal error: no selection property context for display</td></tr><tr><td align="left">noWidgetAncestor</td><td align="left">windowedAncestor</td><td align="left">Object "%s" does not have windowed ancestor</td></tr><tr><td align="left">nullDisplay</td><td align="left">xtRegisterExtensionSelector</td><td align="left">XtRegisterExtensionSelector requires a non-NULL display</td></tr><tr><td align="left">nullProc</td><td align="left">insertChild</td><td align="left">"%s" parent has NULL insert_child method</td></tr><tr><td align="left">r2versionMismatch</td><td align="left">widget</td><td align="left">Widget class %s must be re-compiled.</td></tr><tr><td align="left">R3versionMismatch</td><td align="left">widget</td><td align="left">Widget class %s must be re-compiled.</td></tr><tr><td align="left">R4orR5versionMismatch</td><td align="left">widget</td><td align="left">Widget class %s must be re-compiled.</td></tr><tr><td align="left">rangeError</td><td align="left">xtRegisterExtensionSelector</td><td align="left">Attempt to register multiple selectors for one extension event type</td></tr><tr><td align="left">sessionManagement</td><td align="left">SmcOpenConnection</td><td align="left">Tried to connect to session manager, %s</td></tr><tr><td align="left">subclassMismatch</td><td align="left">xtCheckSubclass</td><td align="left">Widget class %s found when subclass of %s expected: %s</td></tr></tbody></table></div><p><span class="strong"><strong>Warning Messages</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /></colgroup><thead><tr><th align="left">Name</th><th align="left">Type</th><th align="left">Default Message</th></tr></thead><tbody><tr><td align="left">ambiguousParent</td><td align="left">xtChangeManagedSet</td><td align="left">Not all children have same parent</td></tr><tr><td align="left">ambiguousParent</td><td align="left">xtManageChildren</td><td align="left">Not all children have same parent in XtManageChildren</td></tr><tr><td align="left">ambiguousParent</td><td align="left">xtUnmanageChildren</td><td align="left">Not all children have same parent in XtUnmanageChildren</td></tr><tr><td align="left">badFormat</td><td align="left">xtGetSelectionValue</td><td align="left">Selection owner returned type INCR property with format != 32</td></tr><tr><td align="left">badGeometry</td><td align="left">shellRealize</td><td align="left">Shell widget "%s" has an invalid geometry specification: "%s"</td></tr><tr><td align="left">badValue</td><td align="left">cvtStringToPixel</td><td align="left">Color name "%s" is not defined</td></tr><tr><td align="left">communicationError</td><td align="left">select</td><td align="left">Select failed; error code %s</td></tr><tr><td align="left">conversionError</td><td align="left">string</td><td align="left">Cannot convert string "%s" to type %s</td></tr><tr><td align="left">conversionError</td><td align="left">stringToVisual</td><td align="left">Cannot find Visual of class %s for display %s</td></tr><tr><td align="left">conversionFailed</td><td align="left">xtConvertVarToArgList</td><td align="left">Type conversion failed</td></tr><tr><td align="left">conversionFailed</td><td align="left">xtGetTypedArg</td><td align="left">Type conversion (%s to %s) failed for widget '%s'</td></tr><tr><td align="left">displayError</td><td align="left">invalidDisplay</td><td align="left">Can't find display structure</td></tr><tr><td align="left">grabError</td><td align="left">xtAddGrab</td><td align="left">XtAddGrab requires exclusive grab if spring_loaded is TRUE</td></tr><tr><td align="left">grabError</td><td align="left">xtRemoveGrab</td><td align="left">XtRemoveGrab asked to remove a widget not on the list</td></tr><tr><td align="left">initializationError</td><td align="left">xtInitialize</td><td align="left">Initializing Resource Lists twice</td></tr><tr><td align="left">insufficientSpace</td><td align="left">xtGetTypedArg</td><td align="left">Insufficient space for converted type '%s' in widget '%s'</td></tr><tr><td align="left">internalError</td><td align="left">shell</td><td align="left">Shell's window manager interaction is broken</td></tr><tr><td align="left">invalidAddressMode</td><td align="left">computeArgs</td><td align="left">Conversion arguments for widget '%s' contain an unsupported address mode</td></tr><tr><td align="left">invalidArgCount</td><td align="left">getResources</td><td align="left">argument count > 0 on NULL argument list</td></tr><tr><td align="left">invalidCallbackList</td><td align="left">xtAddCallback</td><td align="left">Cannot find callback list in XtAddCallback</td></tr><tr><td align="left">invalidCallbackList</td><td align="left">xtAddCallback</td><td align="left">Cannot find callback list in XtAddCallbacks</td></tr><tr><td align="left">invalidCallbackList</td><td align="left">xtCallCallback</td><td align="left">Cannot find callback list in XtCallCallbacks</td></tr><tr><td align="left">invalidCallbackList</td><td align="left">xtRemoveAllCallback</td><td align="left">Cannot find callback list in XtRemoveAllCallbacks</td></tr><tr><td align="left">invalidCallbackList</td><td align="left">xtRemoveCallback</td><td align="left">Cannot find callback list in XtRemoveCallbacks</td></tr><tr><td align="left">invalidChild</td><td align="left">xtChangeManagedSet</td><td align="left">Null child passed to UnmanageChildren</td></tr><tr><td align="left">invalidChild</td><td align="left">xtManageChildren</td><td align="left">null child passed to ManageChildren</td></tr><tr><td align="left">invalidChild</td><td align="left">xtManageChildren</td><td align="left">null child passed to XtManageChildren</td></tr><tr><td align="left">invalidChild</td><td align="left">xtUnmanageChildren</td><td align="left">Null child passed to XtUnmanageChildren</td></tr><tr><td align="left">invalidChild</td><td align="left">xtUnmanageChildren</td><td align="left">Null child found in argument list to unmanage</td></tr><tr><td align="left">invalidDepth</td><td align="left">setValues</td><td align="left">Can't change widget depth</td></tr><tr><td align="left">invalidExtension</td><td align="left">xtCreateWidget</td><td align="left">widget "%s" class %s has invalid CompositeClassExtension record</td></tr><tr><td align="left">invalidExtension</td><td align="left">xtCreateWidget</td><td align="left">widget class %s has invalid ConstraintClassExtension record</td></tr><tr><td align="left">invalidGrab</td><td align="left">ungrabKeyOrButton</td><td align="left">Attempt to remove nonexistent passive grab</td></tr><tr><td align="left">invalidGrabKind</td><td align="left">xtPopup</td><td align="left">grab kind argument has invalid value; XtGrabNone assumed</td></tr><tr><td align="left">invalidParameters</td><td align="left">freeTranslations</td><td align="left">Freeing XtTranslations requires no extra arguments</td></tr><tr><td align="left">invalidParameters</td><td align="left">mergeTranslations</td><td align="left">MergeTM to TranslationTable needs no extra arguments</td></tr><tr><td align="left">invalidParameters</td><td align="left">xtMenuPopdown</td><td align="left">XtMenuPopdown called with num_params != 0 or 1</td></tr><tr><td align="left">invalidParameters</td><td align="left">xtMenuPopupAction</td><td align="left">MenuPopup wants exactly one argument</td></tr><tr><td align="left">invalidParent</td><td align="left">xtCopyFromParent</td><td align="left">CopyFromParent must have non-NULL parent</td></tr><tr><td align="left">invalidPopup</td><td align="left">xtMenuPopup</td><td align="left">Can't find popup widget "%s" in XtMenuPopup</td></tr><tr><td align="left">invalidPopup</td><td align="left">xtMenuPopdown</td><td align="left">Can't find popup in widget "%s" in XtMenuPopdown</td></tr><tr><td align="left">invalidPopup</td><td align="left">unsupportedOperation</td><td align="left">Pop-up menu creation is only supported on ButtonPress, KeyPress or EnterNotify events.</td></tr><tr><td align="left">invalidPopup</td><td align="left">unsupportedOperation</td><td align="left">Pop-up menu creation is only supported on Button, Key or EnterNotify events.</td></tr><tr><td align="left">invalidProcedure</td><td align="left">deleteChild</td><td align="left">null delete_child procedure for class %s in XtDestroy</td></tr><tr><td align="left">invalidProcedure</td><td align="left">inputHandler</td><td align="left">XtRemoveInput: Input handler not found</td></tr><tr><td align="left">invalidProcedure</td><td align="left">set_values_almost</td><td align="left">set_values_almost procedure shouldn't be NULL</td></tr><tr><td align="left">invalidResourceCount</td><td align="left">getResources</td><td align="left">resource count > 0 on NULL resource list</td></tr><tr><td align="left">invalidResourceName</td><td align="left">computeArgs</td><td align="left">Cannot find resource name %s as argument to conversion</td></tr><tr><td align="left">invalidShell</td><td align="left">xtTranslateCoords</td><td align="left">Widget has no shell ancestor</td></tr><tr><td align="left">invalidSizeOverride</td><td align="left">xtDependencies</td><td align="left">Representation size %d must match superclass's to override %s</td></tr><tr><td align="left">missingCharsetList</td><td align="left">cvtStringToFontSet</td><td align="left">Missing charsets in String to FontSet conversion</td></tr><tr><td align="left">noActionProc</td><td align="left">xtCallActionProc</td><td align="left">No action proc named "%s" is registered for widget "%s"</td></tr><tr><td align="left">noColormap</td><td align="left">cvtStringToPixel</td><td align="left">Cannot allocate colormap entry for "%s"</td></tr><tr><td align="left">noFont</td><td align="left">cvtStringToFont</td><td align="left">Unable to load any usable ISO8859-1 font</td></tr><tr><td align="left">noFont</td><td align="left">cvtStringToFontSet</td><td align="left">Unable to load any usable fontset</td></tr><tr><td align="left">noFont</td><td align="left">cvtStringToFontStruct</td><td align="left">Unable to load any usable ISO8859-1 font</td></tr><tr><td align="left">notInConvertSelection</td><td align="left">xtGetSelectionRequest</td><td align="left">XtGetSelectionRequest or XtGetSelectionParameters called for widget "%s" outside of ConvertSelection proc</td></tr><tr><td align="left">notRectObj</td><td align="left">xtChangeManagedSet</td><td align="left">child "%s", class %s is not a RectObj</td></tr><tr><td align="left">notRectObj</td><td align="left">xtManageChildren</td><td align="left">child "%s", class %s is not a RectObj</td></tr><tr><td align="left">nullWidget</td><td align="left">xtConvertVarToArgList</td><td align="left">XtVaTypedArg conversion needs non-NULL widget handle</td></tr><tr><td align="left">r3versionMismatch</td><td align="left">widget</td><td align="left">Shell Widget class %s binary compiled for R3</td></tr><tr><td align="left">translationError</td><td align="left">nullTable</td><td align="left">Can't remove accelerators from NULL table</td></tr><tr><td align="left">translationError</td><td align="left">nullTable</td><td align="left">Tried to remove nonexistent accelerators</td></tr><tr><td align="left">translationError</td><td align="left">ambiguousActions</td><td align="left">Overriding earlier translation manager actions.</td></tr><tr><td align="left">translationError</td><td align="left">newActions</td><td align="left">New actions are:%s</td></tr><tr><td align="left">translationError</td><td align="left">nullTable</td><td align="left">table to (un)merge must not be null</td></tr><tr><td align="left">translationError</td><td align="left">nullTable</td><td align="left">Can't translate event through NULL table</td></tr><tr><td align="left">translationError</td><td align="left">oldActions</td><td align="left">Previous entry was: %s %s</td></tr><tr><td align="left">translationError</td><td align="left">unboundActions</td><td align="left">Actions not found: %s</td></tr><tr><td align="left">translationError</td><td align="left">xtTranslateInitialize</td><td align="left">Initializing Translation manager twice.</td></tr><tr><td align="left">translationParseError</td><td align="left">missingComma</td><td align="left"> ... possibly due to missing ',' in event sequence.</td></tr><tr><td align="left">translationParseError</td><td align="left">nonLatin1</td><td align="left"> ... probably due to non-Latin1 character in quoted string</td></tr><tr><td align="left">translationParseError</td><td align="left">parseError</td><td align="left">translation table syntax error: %s</td></tr><tr><td align="left">translationParseError</td><td align="left">parseString</td><td align="left">Missing '"'.</td></tr><tr><td align="left">translationParseError</td><td align="left">showLine</td><td align="left"> ... found while parsing '%s'</td></tr><tr><td align="left">typeConversionError</td><td align="left">noConverter</td><td align="left">No type converter registered for '%s' to '%s' conversion.</td></tr><tr><td align="left">unknownType</td><td align="left">xtConvertVarToArgList</td><td align="left">Unable to find type of resource for conversion</td></tr><tr><td align="left">unknownType</td><td align="left">xtGetTypedArg</td><td align="left">Unable to find type of resource for conversion</td></tr><tr><td align="left">versionMismatch</td><td align="left">widget</td><td align="left">Widget class %s version mismatch (recompilation needed):\\n widget %d vs. intrinsics %d.</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntOrPixelToXColor</td><td align="left">Pixel to color conversion needs screen and colormap arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToBool</td><td align="left">Integer to Bool conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToBoolean</td><td align="left">Integer to Boolean conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToFloat</td><td align="left">Integer to Float conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToFont</td><td align="left">Integer to Font conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToPixel</td><td align="left">Integer to Pixel conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToPixmap</td><td align="left">Integer to Pixmap conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToShort</td><td align="left">Integer to Short conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtIntToUnsignedChar</td><td align="left">Integer to UnsignedChar conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToAcceleratorTable</td><td align="left">String to AcceleratorTable conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToAtom</td><td align="left">String to Atom conversion needs Display argument</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToBool</td><td align="left">String to Bool conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToBoolean</td><td align="left">String to Boolean conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToCommandArgArray</td><td align="left">String to CommandArgArray conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToCursor</td><td align="left">String to cursor conversion needs display argument</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToDimension</td><td align="left">String to Dimension conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToDirectoryString</td><td align="left">String to DirectoryString conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToDisplay</td><td align="left">String to Display conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToFile</td><td align="left">String to File conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToFloat</td><td align="left">String to Float conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToFont</td><td align="left">String to font conversion needs display argument</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToFontSet</td><td align="left">String to FontSet conversion needs display and locale arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToFontStruct</td><td align="left">String to font conversion needs display argument</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToGravity</td><td align="left">String to Gravity conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToInitialState</td><td align="left">String to InitialState conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToInt</td><td align="left">String to Integer conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToPixel</td><td align="left">String to pixel conversion needs screen and colormap arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToRestartStyle</td><td align="left">String to RestartStyle conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToShort</td><td align="left">String to Integer conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToTranslationTable</td><td align="left">String to TranslationTable conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToUnsignedChar</td><td align="left">String to Integer conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtStringToVisual</td><td align="left">String to Visual conversion needs screen and depth arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">cvtXColorToPixel</td><td align="left">Color to Pixel conversion needs no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">freeCursor</td><td align="left">Free Cursor requires display argument</td></tr><tr><td align="left">wrongParameters</td><td align="left">freeDirectoryString</td><td align="left">Free Directory String requires no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">freeFile</td><td align="left">Free File requires no extra arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">freeFont</td><td align="left">Free Font needs display argument</td></tr><tr><td align="left">wrongParameters</td><td align="left">freeFontSet</td><td align="left">FreeFontSet needs display and locale arguments</td></tr><tr><td align="left">wrongParameters</td><td align="left">freeFontStruct</td><td align="left">Free FontStruct requires display argument</td></tr><tr><td align="left">wrongParameters</td><td align="left">freePixel</td><td align="left">Freeing a pixel requires screen and colormap arguments</td></tr></tbody></table></div></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="Defined_Strings"></a>Appendix E. Defined Strings</h1></div></div></div><p>
The <code class="function">StringDefs.h</code>
header file contains definitions for the following resource name,
class, and representation type symbolic constants.
</p><p><span class="strong"><strong>Resource names:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtNaccelerators</td><td align="left">"accelerators"</td></tr><tr><td align="left">XtNallowHoriz</td><td align="left">"allowHoriz"</td></tr><tr><td align="left">XtNallowVert</td><td align="left">"allowVert"</td></tr><tr><td align="left">XtNancestorSensitive</td><td align="left">"ancestorSensitive"</td></tr><tr><td align="left">XtNbackground</td><td align="left">"background"</td></tr><tr><td align="left">XtNbackgroundPixmap</td><td align="left">"backgroundPixmap"</td></tr><tr><td align="left">XtNbitmap</td><td align="left">"bitmap"</td></tr><tr><td align="left">XtNborder</td><td align="left">"borderColor"</td></tr><tr><td align="left">XtNborderColor</td><td align="left">"borderColor"</td></tr><tr><td align="left">XtNborderPixmap</td><td align="left">"borderPixmap"</td></tr><tr><td align="left">XtNborderWidth</td><td align="left">"borderWidth"</td></tr><tr><td align="left">XtNcallback</td><td align="left">"callback"</td></tr><tr><td align="left">XtNchangeHook</td><td align="left">"changeHook"</td></tr><tr><td align="left">XtNchildren</td><td align="left">"children"</td></tr><tr><td align="left">XtNcolormap</td><td align="left">"colormap"</td></tr><tr><td align="left">XtNconfigureHook</td><td align="left">"configureHook"</td></tr><tr><td align="left">XtNcreateHook</td><td align="left">"createHook"</td></tr><tr><td align="left">XtNdepth</td><td align="left">"depth"</td></tr><tr><td align="left">XtNdestroyCallback</td><td align="left">"destroyCallback"</td></tr><tr><td align="left">XtNdestroyHook</td><td align="left">"destroyHook"</td></tr><tr><td align="left">XtNeditType</td><td align="left">"editType"</td></tr><tr><td align="left">XtNfile</td><td align="left">"file"</td></tr><tr><td align="left">XtNfont</td><td align="left">"font"</td></tr><tr><td align="left">XtNfontSet</td><td align="left">"fontSet"</td></tr><tr><td align="left">XtNforceBars</td><td align="left">"forceBars"</td></tr><tr><td align="left">XtNforeground</td><td align="left">"foreground"</td></tr><tr><td align="left">XtNfunction</td><td align="left">"function"</td></tr><tr><td align="left">XtNgeometryHook</td><td align="left">"geometryHook"</td></tr><tr><td align="left">XtNheight</td><td align="left">"height"</td></tr><tr><td align="left">XtNhighlight</td><td align="left">"highlight"</td></tr><tr><td align="left">XtNhSpace</td><td align="left">"hSpace"</td></tr><tr><td align="left">XtNindex</td><td align="left">"index"</td></tr><tr><td align="left">XtNinitialResourcesPersistent</td><td align="left">"initialResourcesPersistent"</td></tr><tr><td align="left">XtNinnerHeight</td><td align="left">"innerHeight"</td></tr><tr><td align="left">XtNinnerWidth</td><td align="left">"innerWidth"</td></tr><tr><td align="left">XtNinnerWindow</td><td align="left">"innerWindow"</td></tr><tr><td align="left">XtNinsertPosition</td><td align="left">"insertPosition"</td></tr><tr><td align="left">XtNinternalHeight</td><td align="left">"internalHeight"</td></tr><tr><td align="left">XtNinternalWidth</td><td align="left">"internalWidth"</td></tr><tr><td align="left">XtNjumpProc</td><td align="left">"jumpProc"</td></tr><tr><td align="left">XtNjustify</td><td align="left">"justify"</td></tr><tr><td align="left">XtNknobHeight</td><td align="left">"knobHeight"</td></tr><tr><td align="left">XtNknobIndent</td><td align="left">"knobIndent"</td></tr><tr><td align="left">XtNknobPixel</td><td align="left">"knobPixel"</td></tr><tr><td align="left">XtNknobWidth</td><td align="left">"knobWidth"</td></tr><tr><td align="left">XtNlabel</td><td align="left">"label"</td></tr><tr><td align="left">XtNlength</td><td align="left">"length"</td></tr><tr><td align="left">XtNlowerRight</td><td align="left">"lowerRight"</td></tr><tr><td align="left">XtNmappedWhenManaged</td><td align="left">"mappedWhenManaged"</td></tr><tr><td align="left">XtNmenuEntry</td><td align="left">"menuEntry"</td></tr><tr><td align="left">XtNname</td><td align="left">"name"</td></tr><tr><td align="left">XtNnotify</td><td align="left">"notify"</td></tr><tr><td align="left">XtNnumChildren</td><td align="left">"numChildren"</td></tr><tr><td align="left">XtNnumShells</td><td align="left">"numShells"</td></tr><tr><td align="left">XtNorientation</td><td align="left">"orientation"</td></tr><tr><td align="left">XtNparameter</td><td align="left">"parameter"</td></tr><tr><td align="left">XtNpixmap</td><td align="left">"pixmap"</td></tr><tr><td align="left">XtNpopupCallback</td><td align="left">"popupCallback"</td></tr><tr><td align="left">XtNpopdownCallback</td><td align="left">"popdownCallback"</td></tr><tr><td align="left">XtNresize</td><td align="left">"resize"</td></tr><tr><td align="left">XtNreverseVideo</td><td align="left">"reverseVideo"</td></tr><tr><td align="left">XtNscreen</td><td align="left">"screen"</td></tr><tr><td align="left">XtNscrollProc</td><td align="left">"scrollProc"</td></tr><tr><td align="left">XtNscrollDCursor</td><td align="left">"scrollDCursor"</td></tr><tr><td align="left">XtNscrollHCursor</td><td align="left">"scrollHCursor"</td></tr><tr><td align="left">XtNscrollLCursor</td><td align="left">"scrollLCursor"</td></tr><tr><td align="left">XtNscrollRCursor</td><td align="left">"scrollRCursor"</td></tr><tr><td align="left">XtNscrollUCursor</td><td align="left">"scrollUCursor"</td></tr><tr><td align="left">XtNscrollVCursor</td><td align="left">"scrollVCursor"</td></tr><tr><td align="left">XtNselection</td><td align="left">"selection"</td></tr><tr><td align="left">XtNselectionArray</td><td align="left">"selectionArray"</td></tr><tr><td align="left">XtNsensitive</td><td align="left">"sensitive"</td></tr><tr><td align="left">XtNsession</td><td align="left">"session"</td></tr><tr><td align="left">XtNshells</td><td align="left">"shells"</td></tr><tr><td align="left">XtNshown</td><td align="left">"shown"</td></tr><tr><td align="left">XtNspace</td><td align="left">"space"</td></tr><tr><td align="left">XtNstring</td><td align="left">"string"</td></tr><tr><td align="left">XtNtextOptions</td><td align="left">"textOptions"</td></tr><tr><td align="left">XtNtextSink</td><td align="left">"textSink"</td></tr><tr><td align="left">XtNtextSource</td><td align="left">"textSource"</td></tr><tr><td align="left">XtNthickness</td><td align="left">"thickness"</td></tr><tr><td align="left">XtNthumb</td><td align="left">"thumb"</td></tr><tr><td align="left">XtNthumbProc</td><td align="left">"thumbProc"</td></tr><tr><td align="left">XtNtop</td><td align="left">"top"</td></tr><tr><td align="left">XtNtranslations</td><td align="left">"translations"</td></tr><tr><td align="left">XtNunrealizeCallback</td><td align="left">"unrealizeCallback"</td></tr><tr><td align="left">XtNupdate</td><td align="left">"update"</td></tr><tr><td align="left">XtNuseBottom</td><td align="left">"useBottom"</td></tr><tr><td align="left">XtNuseRight</td><td align="left">"useRight"</td></tr><tr><td align="left">XtNvalue</td><td align="left">"value"</td></tr><tr><td align="left">XtNvSpace</td><td align="left">"vSpace"</td></tr><tr><td align="left">XtNwidth</td><td align="left">"width"</td></tr><tr><td align="left">XtNwindow</td><td align="left">"window"</td></tr><tr><td align="left">XtNx</td><td align="left">"x"</td></tr><tr><td align="left">XtNy</td><td align="left">"y"</td></tr></tbody></table></div><p><span class="strong"><strong>Resource classes:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtCAccelerators</td><td align="left">"Accelerators"</td></tr><tr><td align="left">XtCBackground</td><td align="left">"Background"</td></tr><tr><td align="left">XtCBitmap</td><td align="left">"Bitmap"</td></tr><tr><td align="left">XtCBoolean</td><td align="left">"Boolean"</td></tr><tr><td align="left">XtCBorderColor</td><td align="left">"BorderColor"</td></tr><tr><td align="left">XtCBorderWidth</td><td align="left">"BorderWidth"</td></tr><tr><td align="left">XtCCallback</td><td align="left">"Callback"</td></tr><tr><td align="left">XtCColormap</td><td align="left">"Colormap"</td></tr><tr><td align="left">XtCColor</td><td align="left">"Color"</td></tr><tr><td align="left">XtCCursor</td><td align="left">"Cursor"</td></tr><tr><td align="left">XtCDepth</td><td align="left">"Depth"</td></tr><tr><td align="left">XtCEditType</td><td align="left">"EditType"</td></tr><tr><td align="left">XtCEventBindings</td><td align="left">"EventBindings"</td></tr><tr><td align="left">XtCFile</td><td align="left">"File"</td></tr><tr><td align="left">XtCFont</td><td align="left">"Font"</td></tr><tr><td align="left">XtCFontSet</td><td align="left">"FontSet"</td></tr><tr><td align="left">XtCForeground</td><td align="left">"Foreground"</td></tr><tr><td align="left">XtCFraction</td><td align="left">"Fraction"</td></tr><tr><td align="left">XtCFunction</td><td align="left">"Function"</td></tr><tr><td align="left">XtCHeight</td><td align="left">"Height"</td></tr><tr><td align="left">XtCHSpace</td><td align="left">"HSpace"</td></tr><tr><td align="left">XtCIndex</td><td align="left">"Index"</td></tr><tr><td align="left">XtCInitialResourcesPersistent</td><td align="left">"InitialResourcesPersistent"</td></tr><tr><td align="left">XtCInsertPosition</td><td align="left">"InsertPosition"</td></tr><tr><td align="left">XtCInterval</td><td align="left">"Interval"</td></tr><tr><td align="left">XtCJustify</td><td align="left">"Justify"</td></tr><tr><td align="left">XtCKnobIndent</td><td align="left">"KnobIndent"</td></tr><tr><td align="left">XtCKnobPixel</td><td align="left">"KnobPixel"</td></tr><tr><td align="left">XtCLabel</td><td align="left">"Label"</td></tr><tr><td align="left">XtCLength</td><td align="left">"Length"</td></tr><tr><td align="left">XtCMappedWhenManaged</td><td align="left">"MappedWhenManaged"</td></tr><tr><td align="left">XtCMargin</td><td align="left">"Margin"</td></tr><tr><td align="left">XtCMenuEntry</td><td align="left">"MenuEntry"</td></tr><tr><td align="left">XtCNotify</td><td align="left">"Notify"</td></tr><tr><td align="left">XtCOrientation</td><td align="left">"Orientation"</td></tr><tr><td align="left">XtCParameter</td><td align="left">"Parameter"</td></tr><tr><td align="left">XtCPixmap</td><td align="left">"Pixmap"</td></tr><tr><td align="left">XtCPosition</td><td align="left">"Position"</td></tr><tr><td align="left">XtCReadOnly</td><td align="left">"ReadOnly"</td></tr><tr><td align="left">XtCResize</td><td align="left">"Resize"</td></tr><tr><td align="left">XtCReverseVideo</td><td align="left">"ReverseVideo"</td></tr><tr><td align="left">XtCScreen</td><td align="left">"Screen"</td></tr><tr><td align="left">XtCScrollProc</td><td align="left">"ScrollProc"</td></tr><tr><td align="left">XtCScrollDCursor</td><td align="left">"ScrollDCursor"</td></tr><tr><td align="left">XtCScrollHCursor</td><td align="left">"ScrollHCursor"</td></tr><tr><td align="left">XtCScrollLCursor</td><td align="left">"ScrollLCursor"</td></tr><tr><td align="left">XtCScrollRCursor</td><td align="left">"ScrollRCursor"</td></tr><tr><td align="left">XtCScrollUCursor</td><td align="left">"ScrollUCursor"</td></tr><tr><td align="left">XtCScrollVCursor</td><td align="left">"ScrollVCursor"</td></tr><tr><td align="left">XtCSelection</td><td align="left">"Selection"</td></tr><tr><td align="left">XtCSelectionArray</td><td align="left">"SelectionArray"</td></tr><tr><td align="left">XtCSensitive</td><td align="left">"Sensitive"</td></tr><tr><td align="left">XtCSession</td><td align="left">"Session"</td></tr><tr><td align="left">XtCSpace</td><td align="left">"Space"</td></tr><tr><td align="left">XtCString</td><td align="left">"String"</td></tr><tr><td align="left">XtCTextOptions</td><td align="left">"TextOptions"</td></tr><tr><td align="left">XtCTextPosition</td><td align="left">"TextPosition"</td></tr><tr><td align="left">XtCTextSink</td><td align="left">"TextSink"</td></tr><tr><td align="left">XtCTextSource</td><td align="left">"TextSource"</td></tr><tr><td align="left">XtCThickness</td><td align="left">"Thickness"</td></tr><tr><td align="left">XtCThumb</td><td align="left">"Thumb"</td></tr><tr><td align="left">XtCTranslations</td><td align="left">"Translations"</td></tr><tr><td align="left">XtCValue</td><td align="left">"Value"</td></tr><tr><td align="left">XtCVSpace</td><td align="left">"VSpace"</td></tr><tr><td align="left">XtCWidth</td><td align="left">"Width"</td></tr><tr><td align="left">XtCWindow</td><td align="left">"Window"</td></tr><tr><td align="left">XtCX</td><td align="left">"X"</td></tr><tr><td align="left">XtCY</td><td align="left">"Y"</td></tr></tbody></table></div><p><span class="strong"><strong>Resource representation types:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtRAcceleratorTable</td><td align="left">"AcceleratorTable"</td></tr><tr><td align="left">XtRAtom</td><td align="left">"Atom"</td></tr><tr><td align="left">XtRBitmap</td><td align="left">"Bitmap"</td></tr><tr><td align="left">XtRBool</td><td align="left">"Bool"</td></tr><tr><td align="left">XtRBoolean</td><td align="left">"Boolean"</td></tr><tr><td align="left">XtRCallback</td><td align="left">"Callback"</td></tr><tr><td align="left">XtRCallProc</td><td align="left">"CallProc"</td></tr><tr><td align="left">XtRCardinal</td><td align="left">"Cardinal"</td></tr><tr><td align="left">XtRColor</td><td align="left">"Color"</td></tr><tr><td align="left">XtRColormap</td><td align="left">"Colormap"</td></tr><tr><td align="left">XtRCommandArgArray</td><td align="left">"CommandArgArray"</td></tr><tr><td align="left">XtRCursor</td><td align="left">"Cursor"</td></tr><tr><td align="left">XtRDimension</td><td align="left">"Dimension"</td></tr><tr><td align="left">XtRDirectoryString</td><td align="left">"DirectoryString"</td></tr><tr><td align="left">XtRDisplay</td><td align="left">"Display"</td></tr><tr><td align="left">XtREditMode</td><td align="left">"EditMode"</td></tr><tr><td align="left">XtREnum</td><td align="left">"Enum"</td></tr><tr><td align="left">XtREnvironmentArray</td><td align="left">"EnvironmentArray"</td></tr><tr><td align="left">XtRFile</td><td align="left">"File"</td></tr><tr><td align="left">XtRFloat</td><td align="left">"Float"</td></tr><tr><td align="left">XtRFont</td><td align="left">"Font"</td></tr><tr><td align="left">XtRFontSet</td><td align="left">"FontSet"</td></tr><tr><td align="left">XtRFontStruct</td><td align="left">"FontStruct"</td></tr><tr><td align="left">XtRFunction</td><td align="left">"Function"</td></tr><tr><td align="left">XtRGeometry</td><td align="left">"Geometry"</td></tr><tr><td align="left">XtRGravity</td><td align="left">"Gravity"</td></tr><tr><td align="left">XtRImmediate</td><td align="left">"Immediate"</td></tr><tr><td align="left">XtRInitialState</td><td align="left">"InitialState"</td></tr><tr><td align="left">XtRInt</td><td align="left">"Int"</td></tr><tr><td align="left">XtRJustify</td><td align="left">"Justify"</td></tr><tr><td align="left">XtRLongBoolean</td><td align="left">XtRBool</td></tr><tr><td align="left">XtRObject</td><td align="left">"Object"</td></tr><tr><td align="left">XtROrientation</td><td align="left">"Orientation"</td></tr><tr><td align="left">XtRPixel</td><td align="left">"Pixel"</td></tr><tr><td align="left">XtRPixmap</td><td align="left">"Pixmap"</td></tr><tr><td align="left">XtRPointer</td><td align="left">"Pointer"</td></tr><tr><td align="left">XtRPosition</td><td align="left">"Position"</td></tr><tr><td align="left">XtRRestartStyle</td><td align="left">"RestartStyle"</td></tr><tr><td align="left">XtRScreen</td><td align="left">"Screen"</td></tr><tr><td align="left">XtRShort</td><td align="left">"Short"</td></tr><tr><td align="left">XtRSmcConn</td><td align="left">"SmcConn"</td></tr><tr><td align="left">XtRString</td><td align="left">"String"</td></tr><tr><td align="left">XtRStringArray</td><td align="left">"StringArray"</td></tr><tr><td align="left">XtRStringTable</td><td align="left">"StringTable"</td></tr><tr><td align="left">XtRUnsignedChar</td><td align="left">"UnsignedChar"</td></tr><tr><td align="left">XtRTranslationTable</td><td align="left">"TranslationTable"</td></tr><tr><td align="left">XtRVisual</td><td align="left">"Visual"</td></tr><tr><td align="left">XtRWidget</td><td align="left">"Widget"</td></tr><tr><td align="left">XtRWidgetClass</td><td align="left">"WidgetClass"</td></tr><tr><td align="left">XtRWidgetList</td><td align="left">"WidgetList"</td></tr><tr><td align="left">XtRWindow</td><td align="left">"Window"</td></tr></tbody></table></div><p><span class="strong"><strong>Boolean enumeration constants:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtEoff</td><td align="left">"off"</td></tr><tr><td align="left">XtEfalse</td><td align="left">"false"</td></tr><tr><td align="left">XtEno</td><td align="left">"no"</td></tr><tr><td align="left">XtEon</td><td align="left">"on"</td></tr><tr><td align="left">XtEtrue</td><td align="left">"true"</td></tr><tr><td align="left">XtEyes</td><td align="left">"yes"</td></tr></tbody></table></div><p><span class="strong"><strong>Orientation enumeration constants:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtEvertical</td><td align="left">"vertical"</td></tr><tr><td align="left">XtEhorizontal</td><td align="left">"horizontal"</td></tr></tbody></table></div><p><span class="strong"><strong>Text edit enumeration constants:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtEtextRead</td><td align="left">"read"</td></tr><tr><td align="left">XtEtextAppend</td><td align="left">"append"</td></tr><tr><td align="left">XtEtextEdit</td><td align="left">"edit"</td></tr></tbody></table></div><p><span class="strong"><strong>Color enumeration constants:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtExtdefaultbackground</td><td align="left">"xtdefaultbackground"</td></tr><tr><td align="left">XtExtdefaultforeground</td><td align="left">"xtdefaultforeground"</td></tr></tbody></table></div><p><span class="strong"><strong>Font constant:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtExtdefaultfont</td><td align="left">"xtdefaultfont"</td></tr></tbody></table></div><p><span class="strong"><strong>Hooks for External Agents constants:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtHcreate</td><td align="left">"Xtcreate"</td></tr><tr><td align="left">XtHsetValues</td><td align="left">"Xtsetvalues"</td></tr><tr><td align="left">XtHmanageChildren</td><td align="left">"XtmanageChildren"</td></tr><tr><td align="left">XtHunmanageChildren</td><td align="left">"XtunmanageChildren"</td></tr><tr><td align="left">XtHmanageSet</td><td align="left">"XtmanageSet"</td></tr><tr><td align="left">XtHunmanageSet</td><td align="left">"XtunmanageSet"</td></tr><tr><td align="left">XtHrealizeWidget</td><td align="left">"XtrealizeWidget"</td></tr><tr><td align="left">XtHunrealizeWidget</td><td align="left">"XtunrealizeWidget"</td></tr><tr><td align="left">XtHaddCallback</td><td align="left">"XtaddCallback"</td></tr><tr><td align="left">XtHaddCallbacks</td><td align="left">"XtaddCallbacks"</td></tr><tr><td align="left">XtHremoveCallback</td><td align="left">"XtremoveCallback"</td></tr><tr><td align="left">XtHremoveCallbacks</td><td align="left">"XtremoveCallbacks"</td></tr><tr><td align="left">XtHremoveAllCallbacks</td><td align="left">"XtremoveAllCallbacks"</td></tr><tr><td align="left">XtHaugmentTranslations</td><td align="left">"XtaugmentTranslations"</td></tr><tr><td align="left">XtHoverrideTranslations</td><td align="left">"XtoverrideTranslations"</td></tr><tr><td align="left">XtHuninstallTranslations</td><td align="left">"XtuninstallTranslations"</td></tr><tr><td align="left">XtHsetKeyboardFocus</td><td align="left">"XtsetKeyboardFocus"</td></tr><tr><td align="left">XtHsetWMColormapWindows</td><td align="left">"XtsetWMColormapWindows"</td></tr><tr><td align="left">XtHmapWidget</td><td align="left">"XtmapWidget"</td></tr><tr><td align="left">XtHunmapWidget</td><td align="left">"XtunmapWidget"</td></tr><tr><td align="left">XtHpopup</td><td align="left">"Xtpopup"</td></tr><tr><td align="left">XtHpopupSpringLoaded</td><td align="left">"XtpopupSpringLoaded"</td></tr><tr><td align="left">XtHpopdown</td><td align="left">"Xtpopdown"</td></tr><tr><td align="left">XtHconfigure</td><td align="left">"Xtconfigure"</td></tr><tr><td align="left">XtHpreGeometry</td><td align="left">"XtpreGeometry"</td></tr><tr><td align="left">XtHpostGeometry</td><td align="left">"XtpostGeometry"</td></tr><tr><td align="left">XtHdestroy</td><td align="left">"Xtdestroy"</td></tr></tbody></table></div><p>
The
<code class="function">Shell.h</code>
header file contains definitions for the following resource name,
class, and representation type symbolic constants.
</p><p><span class="strong"><strong>Resource names:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtNallowShellResize</td><td align="left">"allowShellResize"</td></tr><tr><td align="left">XtNargc</td><td align="left">"argc"</td></tr><tr><td align="left">XtNargv</td><td align="left">"argv"</td></tr><tr><td align="left">XtNbaseHeight</td><td align="left">"baseHeight"</td></tr><tr><td align="left">XtNbaseWidth</td><td align="left">"baseWidth"</td></tr><tr><td align="left">XtNcancelCallback</td><td align="left">"cancelCallback"</td></tr><tr><td align="left">XtNclientLeader</td><td align="left">"clientLeader"</td></tr><tr><td align="left">XtNcloneCommand</td><td align="left">"cloneCommand"</td></tr><tr><td align="left">XtNconnection</td><td align="left">"connection"</td></tr><tr><td align="left">XtNcreatePopupChildProc</td><td align="left">"createPopupChildProc"</td></tr><tr><td align="left">XtNcurrentDirectory</td><td align="left">"currentDirectory"</td></tr><tr><td align="left">XtNdieCallback</td><td align="left">"dieCallback"</td></tr><tr><td align="left">XtNdiscardCommand</td><td align="left">"discardCommand"</td></tr><tr><td align="left">XtNenvironment</td><td align="left">"environment"</td></tr><tr><td align="left">XtNerrorCallback</td><td align="left">"errorCallback"</td></tr><tr><td align="left">XtNgeometry</td><td align="left">"geometry"</td></tr><tr><td align="left">XtNheightInc</td><td align="left">"heightInc"</td></tr><tr><td align="left">XtNiconMask</td><td align="left">"iconMask"</td></tr><tr><td align="left">XtNiconName</td><td align="left">"iconName"</td></tr><tr><td align="left">XtNiconNameEncoding</td><td align="left">"iconNameEncoding"</td></tr><tr><td align="left">XtNiconPixmap</td><td align="left">"iconPixmap"</td></tr><tr><td align="left">XtNiconWindow</td><td align="left">"iconWindow"</td></tr><tr><td align="left">XtNiconX</td><td align="left">"iconX"</td></tr><tr><td align="left">XtNiconY</td><td align="left">"iconY"</td></tr><tr><td align="left">XtNiconic</td><td align="left">"iconic"</td></tr><tr><td align="left">XtNinitialState</td><td align="left">"initialState"</td></tr><tr><td align="left">XtNinput</td><td align="left">"input"</td></tr><tr><td align="left">XtNinteractCallback</td><td align="left">"interactCallback"</td></tr><tr><td align="left">XtNjoinSession</td><td align="left">"joinSession"</td></tr><tr><td align="left">XtNmaxAspectX</td><td align="left">"maxAspectX"</td></tr><tr><td align="left">XtNmaxAspectY</td><td align="left">"maxAspectY"</td></tr><tr><td align="left">XtNmaxHeight</td><td align="left">"maxHeight"</td></tr><tr><td align="left">XtNmaxWidth</td><td align="left">"maxWidth"</td></tr><tr><td align="left">XtNminAspectX</td><td align="left">"minAspectX"</td></tr><tr><td align="left">XtNminAspectY</td><td align="left">"minAspectY"</td></tr><tr><td align="left">XtNminHeight</td><td align="left">"minHeight"</td></tr><tr><td align="left">XtNminWidth</td><td align="left">"minWidth"</td></tr><tr><td align="left">XtNoverrideRedirect</td><td align="left">"overrideRedirect"</td></tr><tr><td align="left">XtNprogramPath</td><td align="left">"programPath"</td></tr><tr><td align="left">XtNresignCommand</td><td align="left">"resignCommand"</td></tr><tr><td align="left">XtNrestartCommand</td><td align="left">"restartCommand"</td></tr><tr><td align="left">XtNrestartStyle</td><td align="left">"restartStyle"</td></tr><tr><td align="left">XtNsaveCallback</td><td align="left">"saveCallback"</td></tr><tr><td align="left">XtNsaveCompleteCallback</td><td align="left">"saveCompleteCallback"</td></tr><tr><td align="left">XtNsaveUnder</td><td align="left">"saveUnder"</td></tr><tr><td align="left">XtNsessionID</td><td align="left">"sessionID"</td></tr><tr><td align="left">XtNshutdownCommand</td><td align="left">"shutdownCommand"</td></tr><tr><td align="left">XtNtitle</td><td align="left">"title"</td></tr><tr><td align="left">XtNtitleEncoding</td><td align="left">"titleEncoding"</td></tr><tr><td align="left">XtNtransient</td><td align="left">"transient"</td></tr><tr><td align="left">XtNtransientFor</td><td align="left">"transientFor"</td></tr><tr><td align="left">XtNurgency</td><td align="left">"urgency"</td></tr><tr><td align="left">XtNvisual</td><td align="left">"visual"</td></tr><tr><td align="left">XtNwaitForWm</td><td align="left">"waitforwm"</td></tr><tr><td align="left">XtNwaitforwm</td><td align="left">"waitforwm"</td></tr><tr><td align="left">XtNwidthInc</td><td align="left">"widthInc"</td></tr><tr><td align="left">XtNwindowGroup</td><td align="left">"windowGroup"</td></tr><tr><td align="left">XtNwindowRole</td><td align="left">"windowRole"</td></tr><tr><td align="left">XtNwinGravity</td><td align="left">"winGravity"</td></tr><tr><td align="left">XtNwmTimeout</td><td align="left">"wmTimeout"</td></tr></tbody></table></div><p><span class="strong"><strong>Resource classes:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtCAllowShellResize</td><td align="left">"allowShellResize"</td></tr><tr><td align="left">XtCArgc</td><td align="left">"Argc"</td></tr><tr><td align="left">XtCArgv</td><td align="left">"Argv"</td></tr><tr><td align="left">XtCBaseHeight</td><td align="left">"BaseHeight"</td></tr><tr><td align="left">XtCBaseWidth</td><td align="left">"BaseWidth"</td></tr><tr><td align="left">XtCClientLeader</td><td align="left">"ClientLeader"</td></tr><tr><td align="left">XtCCloneCommand</td><td align="left">"CloneCommand"</td></tr><tr><td align="left">XtCConnection</td><td align="left">"Connection"</td></tr><tr><td align="left">XtCCreatePopupChildProc</td><td align="left">"CreatePopupChildProc"</td></tr><tr><td align="left">XtCCurrentDirectory</td><td align="left">"CurrentDirectory"</td></tr><tr><td align="left">XtCDiscardCommand</td><td align="left">"DiscardCommand"</td></tr><tr><td align="left">XtCEnvironment</td><td align="left">"Environment"</td></tr><tr><td align="left">XtCGeometry</td><td align="left">"Geometry"</td></tr><tr><td align="left">XtCHeightInc</td><td align="left">"HeightInc"</td></tr><tr><td align="left">XtCIconMask</td><td align="left">"IconMask"</td></tr><tr><td align="left">XtCIconName</td><td align="left">"IconName"</td></tr><tr><td align="left">XtCIconNameEncoding</td><td align="left">"IconNameEncoding"</td></tr><tr><td align="left">XtCIconPixmap</td><td align="left">"IconPixmap"</td></tr><tr><td align="left">XtCIconWindow</td><td align="left">"IconWindow"</td></tr><tr><td align="left">XtCIconX</td><td align="left">"IconX"</td></tr><tr><td align="left">XtCIconY</td><td align="left">"IconY"</td></tr><tr><td align="left">XtCIconic</td><td align="left">"Iconic"</td></tr><tr><td align="left">XtCInitialState</td><td align="left">"InitialState"</td></tr><tr><td align="left">XtCInput</td><td align="left">"Input"</td></tr><tr><td align="left">XtCJoinSession</td><td align="left">"JoinSession"</td></tr><tr><td align="left">XtCMaxAspectX</td><td align="left">"MaxAspectX"</td></tr><tr><td align="left">XtCMaxAspectY</td><td align="left">"MaxAspectY"</td></tr><tr><td align="left">XtCMaxHeight</td><td align="left">"MaxHeight"</td></tr><tr><td align="left">XtCMaxWidth</td><td align="left">"MaxWidth"</td></tr><tr><td align="left">XtCMinAspectX</td><td align="left">"MinAspectX"</td></tr><tr><td align="left">XtCMinAspectY</td><td align="left">"MinAspectY"</td></tr><tr><td align="left">XtCMinHeight</td><td align="left">"MinHeight"</td></tr><tr><td align="left">XtCMinWidth</td><td align="left">"MinWidth"</td></tr><tr><td align="left">XtCOverrideRedirect</td><td align="left">"OverrideRedirect"</td></tr><tr><td align="left">XtCProgramPath</td><td align="left">"ProgramPath"</td></tr><tr><td align="left">XtCResignCommand</td><td align="left">"ResignCommand"</td></tr><tr><td align="left">XtCRestartCommand</td><td align="left">"RestartCommand"</td></tr><tr><td align="left">XtCRestartStyle</td><td align="left">"RestartStyle"</td></tr><tr><td align="left">XtCSaveUnder</td><td align="left">"SaveUnder"</td></tr><tr><td align="left">XtCSessionID</td><td align="left">"SessionID"</td></tr><tr><td align="left">XtCShutdownCommand</td><td align="left">"ShutdownCommand"</td></tr><tr><td align="left">XtCTitle</td><td align="left">"Title"</td></tr><tr><td align="left">XtCTitleEncoding</td><td align="left">"TitleEncoding"</td></tr><tr><td align="left">XtCTransient</td><td align="left">"Transient"</td></tr><tr><td align="left">XtCTransientFor</td><td align="left">"TransientFor"</td></tr><tr><td align="left">XtCUrgency</td><td align="left">"Urgency"</td></tr><tr><td align="left">XtCVisual</td><td align="left">"Visual"</td></tr><tr><td align="left">XtCWaitForWm</td><td align="left">"Waitforwm"</td></tr><tr><td align="left">XtCWaitforwm</td><td align="left">"Waitforwm"</td></tr><tr><td align="left">XtCWidthInc</td><td align="left">"WidthInc"</td></tr><tr><td align="left">XtCWindowGroup</td><td align="left">"WindowGroup"</td></tr><tr><td align="left">XtCWindowRole</td><td align="left">"WindowRole"</td></tr><tr><td align="left">XtCWinGravity</td><td align="left">"WinGravity"</td></tr><tr><td align="left">XtCWmTimeout</td><td align="left">"WmTimeout"</td></tr></tbody></table></div><p><span class="strong"><strong>Resource representation types:</strong></span></p><div class="informaltable"><table border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Symbol</th><th align="left">Definition</th></tr></thead><tbody><tr><td align="left">XtRAtom</td><td align="left">"Atom"</td></tr></tbody></table></div></div><div class="appendix"><div class="titlepage"><div><div><h1 class="title"><a id="Resource_Configuration_Management"></a>Appendix F. Resource Configuration Management</h1></div></div></div><p>
Setting and changing resources in X applications can be difficult for
both the application programmer and the end user. <span class="strong"><strong>Resource
Configuration Management (RCM)</strong></span> addresses this problem by changing
the <code class="function">X Intrinsics</code> to immediately modify a resource for a
specified widget and each child widget in the hierarchy.
In this context, immediate means: no sourcing of a resource
file is required; the application does not need to be restarted for the
new resource values to take effect; and the change
occurs immediately.
</p><p>
The main difference between <code class="function">RCM</code> and the <code class="function">Editres</code>
protocol is that the <code class="function">RCM</code>
customizing hooks reside in the <code class="function">Intrinsics</code> and thus are linked with
other toolkits such as Motif and the Athena widgets. However, the
<code class="function">EditRes</code> protocol requires the application to link with the
<code class="function">EditRes</code>
routines in the Xmu library and Xmu is not used by all applications that
use Motif. Also, the <code class="function">EditRes</code> protocol uses ClientMessage,
whereas the
<code class="function">RCM</code> <code class="function">Intrinsics</code> hooks use <code class="function">PropertyNotify</code> events.
</p><p>
X Properties and the <code class="function">PropertyNotify</code> events are used
to implement <code class="function">RCM</code> and
allow on-the-fly resource customization. When the X Toolkit is
initialized, two atoms are interned with the strings
<span class="emphasis"><em>Custom Init</em></span> and
<span class="emphasis"><em>Custom Data</em></span>. Both
<code class="function">_XtCreatePopupShell</code>
and
<code class="function">_XtAppCreateShell</code>
register a <code class="function">PropertyNotify</code> event handler to handle these properties.
</p><p>
A customization tool uses the <span class="emphasis"><em>Custom Init</em></span> property to <span class="emphasis"><em>ping</em></span> an
application to get the application's toplevel window. When the
application's property notify event handler is invoked, the handler
deletes the property. No data is transferred in this property.
</p><p>
A customization tool uses the <span class="emphasis"><em>Custom Data</em></span> property to tell an
application that it should change a resource's value. The data in
the property contains the length of the resource name (the number
of bytes in the resource name), the resource name and the new
value for the resource. This property's type is <code class="function">XA_STRING</code> and
the format of the string is:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
The length of the resource name (the number of bytes in
the resource name)
</p></li><li class="listitem"><p>
One space character
</p></li><li class="listitem"><p>
The resource name
</p></li><li class="listitem"><p>
One space character
</p></li><li class="listitem"><p>
The resource value
</p></li></ol></div><p>
When setting the application's resource, the event handler calls
functions to walk the application's widget tree, determining which
widgets are affected by the resource string, and then applying the value
with
<a class="xref" href="#XtSetValues"><code class="function">XtSetValues</code></a>.
As the widget tree is recursively descended, at
each level in the widget tree a resource part is tested for a match.
When the entire resource string has been matched, the value is applied
to the widget or widgets.
</p><p>
Before a value is set on a widget, it is first determined if the last
part of the resource is a valid resource for that widget. It must also
add the resource to the application's resource database and then query
it using specific resource strings that is builds from the widget
information.
</p></div></div></body></html>
|