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
|
.\" $XdotOrg: xc/doc/specs/Xmu/Xmu.ms,v 1.2 2004/04/23 18:42:19 eich Exp $
.\" $XFree86$
.\"
.sp 8
.ce 2
\s+2\fBXmu Library\fP\s-2
.sp 6p
X Version 11, Release 6.8
.sp 1
.ce 1
``\fIDon't ask.\fP''
.sp 2
.LP
Copyright \(co 1989 X Consortium
.LP
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:
.LP
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.LP
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.
.LP
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.
.sp 3
\fIX Window System\fP is a trademark of The Open Group.
.bp
.NH 1
Introduction
.LP
The Xmu Library is a collection of miscellaneous (some might say random)
utility functions that have been useful in building various applications
and widgets. This library is required by the Athena Widgets.
.LP
.NH 1
Atom Functions
.LP
The use the functions and macros defined in this section, you should include
the header file
.Pn < X11/Xmu/Atoms.h >.
.sp
.FD 0
XA_ATOM_PAIR(\fId\fP)
XA_CHARACTER_POSITION(\fId\fP)
XA_CLASS(\fId\fP)
XA_CLIENT_WINDOW(\fId\fP)
XA_CLIPBOARD(\fId\fP)
XA_COMPOUND_TEXT(\fId\fP)
XA_DECNET_ADDRESS(\fId\fP)
XA_DELETE(\fId\fP)
XA_FILENAME(\fId\fP)
XA_HOSTNAME(\fId\fP)
XA_IP_ADDRESS(\fId\fP)
XA_LENGTH(\fId\fP)
XA_LIST_LENGTH(\fId\fP)
XA_NAME(\fId\fP)
XA_NET_ADDRESS(\fId\fP)
XA_NULL(\fId\fP)
XA_OWNER_OS(\fId\fP)
XA_SPAN(\fId\fP)
XA_TARGETS(\fId\fP)
XA_TEXT(\fId\fP)
XA_TIMESTAMP(\fId\fP)
XA_USER(\fId\fP)
XA_UTF8_STRING(\fId\fP)
.FN
.LP
These macros take a display as argument and return an
.PN Atom .
The name of the
atom is obtained from the macro name by removing the leading characters
``XA_''. The
.PN Atom
value is cached, such that subsequent requests do not cause
another round-trip to the server.
.sp
.FD 0
AtomPtr XmuMakeAtom(\fIname\fP)
.br
char* \fIname\fP;
.FN
.IP \fIname\fP 1i
specifies the atom name
.LP
This function creates and initializes an opaque object, an
.PN AtomPtr ,
for an
.PN Atom
with the
given name.
.PN XmuInternAtom
can be used to cache the Atom value for one or more displays.
.sp
.FD 0
char *XmuNameOfAtom(\fIatom_ptr\fP)
.br
AtomPtr \fIatom_ptr\fP;
.FN
.IP \fIatom_ptr\fP 1i
specifies the AtomPtr
.LP
The function returns the name of an AtomPtr.
.sp
.FD 0
Atom XmuInternAtom(\fId\fP, \fIatom_ptr\fP)
.br
Display *\fId\fP;
.br
AtomPtr \fIatom_ptr\fP;
.FN
.IP \fId\fP 1i
specifies the connection to the X server
.IP \fIatom_ptr\fP 1i
specifies the AtomPtr
.LP
This function returns the
.PN Atom
for an
.PN AtomPtr .
The
.PN Atom
is cached,
such that subsequent requests do not cause another round-trip to the server.
.sp
.FD 0
char *XmuGetAtomName(\fId\fP, \fIatom\fP)
.br
Display *\fId\fP;
.br
Atom \fIatom\fP;
.FN
.IP \fId\fP 1i
specifies the connection to the X server
.IP \fIatom\fP 1i
specifies the atom whose name is desired
.LP
This function returns the name of an
.PN Atom .
The result is cached, such that subsequent
requests do not cause another round-trip to the server.
.sp
.FD 0
void XmuInternStrings(\fId\fP, \fInames\fP, \fIcount\fP, \fIatoms\fP)
.br
Display *\fId\fP;
.br
String *\fInames\fP;
.br
Cardinal \fIcount\fP;
.br
Atom *\fIatoms\fP;
.FN
.IP \fId\fP 1i
specifies the connection to the X server
.IP \fInames\fP 1i
specifies the strings to intern
.IP \fIcount\fP 1i
specifies the number of strings
.IP \fIatoms\fP 1i
returns the list of Atom values
.LP
This function converts a list of atom names into
.PN Atom
values. The results are cached, such
that subsequent requests do not cause further round-trips to the server.
The caller is responsible for preallocating the array pointed at by atoms.
.LP
.NH 1
Error Handler Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/Error.h >.
.sp
.FD 0
int XmuPrintDefaultErrorMessage(\fIdpy\fP, \fIevent\fP, \fIfp\fP)
.br
Display *\fIdpy\fP;
.br
XErrorEvent *\fIevent\fP;
.br
FILE *\fIfp\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIevent\fP 1i
specifies the error
.IP \fIfp\fP 1i
specifies where to print the error message
.LP
This function prints an error message, equivalent to Xlib's default error
message for protocol errors. It returns a non-zero value
if the caller should consider exiting, otherwise it returns 0.
This function can be used when you need to
write your own error handler, but need to print out an error from within
that handler.
.sp
.FD 0
int XmuSimpleErrorHandler(\fIdpy\fP, \fIerrorp\fP)
.br
Display *\fIdpy\fP;
.br
XErrorEvent *\fIerrorp\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIerrorp\fP 1i
specifies the error
.LP
This function ignores errors for
.PN BadWindow
errors for
.PN XQueryTree
and
.PN XGetWindowAttributes ,
and ignores
.PN BadDrawable
errors for
.PN XGetGeometry ;
it returns 0 in those cases. Otherwise, it prints the default error message,
and returns a non-zero value if the caller should consider exiting,
and 0 if the caller should not exit.
.LP
.NH 1
System Utility Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/SysUtil.h >.
.sp
.FD 0
int XmuGetHostname(\fIbuf\fP, \fImaxlen\fP)
.br
char *\fIbuf\fP;
.br
int \fImaxlen\fP;
.FN
.IP \fIbuf\fP 1i
returns the host name
.IP \fImaxlen\fP 1i
specifies the length of buf
.LP
This function stores the null terminated name of the local host in buf, and
returns length of the name. This function hides operating system differences,
such as whether to call gethostname or uname.
.LP
.NH 1
Window Utility Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/WinUtil.h >.
.sp
.FD 0
Screen *XmuScreenOfWindow(\fIdpy\fP, \fIw\fP)
.br
Display *\fIdpy\fP;
.br
Window \fIw\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIw\fP 1i
specifies the window
.LP
This function returns the
.PN Screen
on which the specified window was created.
.sp
.FD 0
Window XmuClientWindow(\fIdpy\fP, \fIwin\fP)
.br
Display *\fIdpy\fP;
.br
Window \fIwin\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIwin\fP 1i
specifies the window
.LP
This function finds a window, at or below the specified window, which has a
WM_STATE property. If such a window is found, it is returned, otherwise the
argument window is returned.
.sp
.FD 0
Bool XmuUpdateMapHints(\fIdpy\fP, \fIw\fP, \fIhints\fP)
.br
Display *\fIdpy\fP;
.br
Window \fIw\fP;
.br
XSizeHints *\fIhints\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIwin\fP 1i
specifies the window
.IP \fIhints\fP 1i
specifies the new hints, or NULL
.LP
This function clears the
.PN PPosition
and
.PN PSize
flags and sets the
.PN USPosition
and
.PN USSize
flags in the hints structure, and then stores the hints for the
window using
.PN XSetWMNormalHints
and returns
.PN True .
If NULL is passed for the
hints structure, then the current hints are read back from the window using
.PN XGetWMNormalHints
and are used instead, and
.PN True
is returned; otherwise
.PN False
is returned.
.LP
.NH 1
Cursor Utility Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/CurUtil.h >.
.sp
.FD 0
int XmuCursorNameToIndex(\fIname\fP)
.br
char *\fIname\fP;
.FN
.IP \fIname\fP 1i
specifies the name of the cursor
.LP
This function takes the name of a standard cursor and returns its index
in the standard cursor font. The cursor names are formed by removing the
``XC_'' prefix from the cursor defines listed in Appendix B of the Xlib
manual.
.LP
.NH 1
Graphics Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/Drawing.h >.
.sp
.FD 0
void XmuDrawRoundedRectangle(\fIdpy\fP, \fIdraw\fP, \fIgc\fP, \fIx\fP, \fIy\fP, \fIw\fP, \fIh\fP, \fIew\fP, \fIeh\fP)
.br
Display *\fIdpy\fP;
.br
Drawable \fIdraw\fP;
.br
GC \fIgc\fP;
.br
int \fIx\fP, \fIy\fP, \fIw\fP, \fIh\fP, \fIew\fP, \fIeh\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIdraw\fP 1i
specifies the drawable
.IP \fIgc\fP 1i
specifies the GC
.IP \fIx\fP 1i
specifies the upper left x coordinate
.IP \fIy\fP 1i
specifies the upper left y coordinate
.IP \fIw\fP 1i
specifies the rectangle width
.IP \fIh\fP 1i
specifies the rectangle height
.IP \fIew\fP 1i
specifies the corner width
.IP \fIeh\fP 1i
specifies the corner height
.LP
This function draws a rounded rectangle, where x, y, w, h are the dimensions
of the overall rectangle, and ew and eh are the sizes of a bounding box that
the corners are drawn inside of; ew should be no more than half of w, and eh
should be no more than half of h. The current GC line attributes control
all attributes of the line.
.sp
.FD 0
void XmuFillRoundedRectangle(\fIdpy\fP, \fIdraw\fP, \fIgc\fP, \fIx\fP, \fIy\fP, \fIw\fP, \fIh\fP, \fIew\fP, \fIeh\fP)
.br
Display *\fIdpy\fP;
.br
Drawable \fIdraw\fP;
.br
GC \fIgc\fP;
.br
int \fIx\fP, \fIy\fP, \fIw\fP, \fIh\fP, \fIew\fP, \fIeh\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIdraw\fP 1i
specifies the drawable
.IP \fIgc\fP 1i
specifies the GC
.IP \fIx\fP 1i
specifies the upper left x coordinate
.IP \fIy\fP 1i
specifies the upper left y coordinate
.IP \fIw\fP 1i
specifies the rectangle width
.IP \fIh\fP 1i
specifies the rectangle height
.IP \fIew\fP 1i
specifies the corner width
.IP \fIeh\fP 1i
specifies the corner height
.LP
This function draws a filled rounded rectangle, where x, y, w, h are the
dimensions of the overall rectangle, and ew and eh are the sizes of a
bounding box that the corners are drawn inside of; ew should be no more than
half of w, and eh should be no more than half of h. The current GC fill
settings control all attributes of the fill contents.
.sp
.FD 0
XmuDrawLogo(\fIdpy\fP, \fIdrawable\fP, \fIgcFore\fP, \fIgcBack\fP, \fIx\fP, \fIy\fP, \fIwidth\fP, \fIheight\fP)
.br
Display *\fIdpy\fP;
.br
Drawable \fIdrawable\fP;
.br
GC \fIgcFore\fP, \fIgcBack\fP;
.br
int \fIx\fP, \fIy\fP;
.br
unsigned int \fIwidth\fP, \fIheight\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIdrawable\fP 1i
specifies the drawable
.IP \fIgcFore\fP 1i
specifies the foreground GC
.IP \fIgcBack\fP 1i
specifies the background GC
.IP \fIx\fP 1i
specifies the upper left x coordinate
.IP \fIy\fP 1i
specifies the upper left y coordinate
.IP \fIwidth\fP 1i
specifies the logo width
.IP \fIheight\fP 1i
specifies the logo height
.LP
This function draws the ``official'' X Window System logo. The bounding box
of the logo in the drawable is given by x, y, width, and height. The logo
itself is filled using gcFore, and the rest of the rectangle is filled using
gcBack.
.sp
.FD 0
Pixmap XmuCreateStippledPixmap(\fIscreen\fP, \fIfore\fP, \fIback\fP, \fIdepth\fP)
.br
Screen *\fIscreen\fP;
.br
Pixel \fIfore\fP, \fIback\fP;
.br
unsigned int \fIdepth\fP;
.FN
.IP \fIscreen\fP 1i
specifies the screen the pixmap is created on
.IP \fIfore\fP 1i
specifies the foreground pixel value
.IP \fIback\fP 1i
specifies the background pixel value
.IP \fIdepth\fP 1i
specifies the depth of the pixmap
.LP
This function creates a two pixel by one pixel stippled pixmap of specified
depth on the specified screen. The pixmap is cached so that multiple
requests share the same pixmap. The pixmap should be freed with
.PN XmuReleaseStippledPixmap
to maintain correct reference counts.
.sp
.FD 0
void XmuReleaseStippledPixmap(\fIscreen\fP, \fIpixmap\fP)
.br
Screen *\fIscreen\fP;
.br
Pixmap \fIpixmap\fP;
.FN
.IP \fIscreen\fP 1i
specifies the screen the pixmap was created on
.IP \fIpixmap\fP 1i
specifies the pixmap to free
.LP
This function frees a pixmap created with
.PN XmuCreateStippledPixmap .
.sp
.FD 0
int XmuReadBitmapData(\fIfstream\fP, \fIwidth\fP, \fIheight\fP, \fIdatap\fP, \fIx_hot\fP, \fIy_hot\fP)
FILE *\fIfstream\fP;
unsigned int *\fIwidth\fP, *\fIheight\fP;
unsigned char **\fIdatap\fP;
int *\fIx_hot\fP, *\fIy_hot\fP;
.FN
.IP \fIstream\fP 1i
specifies the stream to read from
.IP \fIwidth\fP 1i
returns the width of the bitmap
.IP \fIheight\fP 1i
returns the height of the bitmap
.IP \fIdatap\fP 1i
returns the parsed bitmap data
.IP \fIx_hot\fP 1i
returns the x coordinate of the hotspot
.IP \fIy_hot\fP 1i
returns the y coordinate of the hotspot
.LP
This function reads a standard bitmap file description from the specified
stream, and returns the parsed data in a format suitable for passing to
.PN XCreateBitmapFromData .
The return value of the function has the same
interpretation as the return value for
.PN XReadBitmapFile .
.sp
.FD 0
int XmuReadBitmapDataFromFile(\fIfilename\fP, \fIwidth\fP, \fIheight\fP, \fIdatap\fP, \fIx_hot\fP, \fIy_hot\fP)
char *\fIfilename\fP;
unsigned int *\fIwidth\fP, *\fIheight\fP;
unsigned char **\fIdatap\fP;
int *\fIx_hot\fP, *\fIy_hot\fP;
.FN
.IP \fIfilename\fP 1i
specifies the file to read from
.IP \fIwidth\fP 1i
returns the width of the bitmap
.IP \fIheight\fP 1i
returns the height of the bitmap
.IP \fIdatap\fP 1i
returns the parsed bitmap data
.IP \fIx_hot\fP 1i
returns the x coordinate of the hotspot
.IP \fIy_hot\fP 1i
returns the y coordinate of the hotspot
.LP
This function reads a standard bitmap file description from the specified
file, and returns the parsed data in a format suitable for passing to
.PN XCreateBitmapFromData .
The return value of the function has the same
interpretation as the return value for
.PN XReadBitmapFile .
.sp
.FD 0
Pixmap XmuLocateBitmapFile(\fIscreen\fP, \fIname\fP, \fIsrcname\fP, \fIsrcnamelen\fP, \fIwidthp\fP, \fIheightp\fP, \fIxhotp\fP, \fIyhotp\fP)
Screen *\fIscreen\fP;
char *\fIname\fP;
char *\fIsrcname\fP;
int \fIsrcnamelen\fP;
int *\fIwidthp\fP, *\fIheightp\fP, *\fIxhotp\fP, *\fIyhotp\fP;
.FN
.IP \fIscreen\fP 1i
specifies the screen the pixmap is created on
.IP \fIname\fP 1i
specifies the file to read from
.IP \fIsrcname\fP 1i
returns the full filename of the bitmap
.IP \fIsrcnamelen\fP 1i
specifies the length of the srcname buffer
.IP \fIwidth\fP 1i
returns the width of the bitmap
.IP \fIheight\fP 1i
returns the height of the bitmap
.IP \fIxhotp\fP 1i
returns the x coordinate of the hotspot
.IP \fIyhotp\fP 1i
returns the y coordinate of the hotspot
.LP
This function reads a file in standard bitmap file format, using
.PN XReadBitmapFile ,
and returns the created bitmap. The filename may be
absolute, or relative to the global resource named bitmapFilePath with class
BitmapFilePath. If the resource is not defined, the default value is the
build symbol BITMAPDIR, which is typically "/usr/include/X11/bitmaps". If
srcnamelen is greater than zero and srcname is not NULL, the null terminated
filename will be copied into srcname. The size and hotspot of the bitmap are
also returned.
.sp
.FD 0
Pixmap XmuCreatePixmapFromBitmap(\fIdpy\fP, \fId\fP, \fIbitmap\fP, \fIwidth\fP, \fIheight\fP, \fIdepth\fP, \fIfore\fP, \fIback\fP)
Display *\fIdpy\fP;
Drawable \fId\fP;
Pixmap \fIbitmap\fP;
unsigned int \fIwidth\fP, \fIheight\fP;
unsigned int \fIdepth\fP;
unsigned long \fIfore\fP, \fIback\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fId\fP 1i
specifies the screen the pixmap is created on
.IP \fIbitmap\fP 1i
specifies the bitmap source
.IP \fIwidth\fP 1i
specifies the width of the pixmap
.IP \fIheight\fP 1i
specifies the height of the pixmap
.IP \fIdepth\fP 1i
specifies the depth of the pixmap
.IP \fIfore\fP 1i
specifies the foreground pixel value
.IP \fIback\fP 1i
specifies the background pixel value
.LP
This function creates a pixmap of the specified width, height, and depth, on
the same screen as the specified drawable, and then performs an
.PN XCopyPlane
from the specified bitmap to the pixmap,
using the specified foreground and background pixel values.
The created pixmap is returned.
.LP
.NH 1
Selection Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/StdSel.h >.
.sp
.FD 0
Boolean XmuConvertStandardSelection(\fIw\fP, \fItime\fP, \fIselection\fP, \fItarget\fP, \fItype\fP, \fIvalue\fP, \fIlength\fP, \fIformat\fP)
.br
Widget \fIw\fP;
.br
Time \fItime\fP;
.br
Atom *\fIselection\fP, *\fItarget\fP, *\fItype\fP;
.br
caddr_t *\fIvalue\fP;
.br
unsigned long *\fIlength\fP;
.br
int *\fIformat\fP;
.FN
.IP \fIw\fP 1i
specifies the widget which currently owns the selection
.IP \fItime\fP 1i
specifies the time at which the selection was established
.IP \fIselection\fP 1i
this argument is ignored
.IP \fItarget\fP 1i
specifies the target type of the selection
.IP \fItype\fP 1i
returns the property type of the converted value
.IP \fIvalue\fP 1i
returns the converted value
.IP \fIlength\fP 1i
returns the number of elements in the converted value
.IP \fIformat\fP 1i
returns the size in bits of the elements
.LP
This function converts the following standard selections: CLASS,
CLIENT_WINDOW, DECNET_ADDRESS, HOSTNAME, IP_ADDRESS, NAME, OWNER_OS,
TARGETS, TIMESTAMP, and USER. It returns
.PN True
if the conversion was successful, else it returns
.PN False.
.LP
.NH 1
Type Converter Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/Converters.h >.
.sp
.FD 0
void XmuCvtFunctionToCallback(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValue *\fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
this argument is ignored
.IP \fInum_args\fP 1i
this argument is ignored
.IP \fIfromVal\fP 1i
the function to convert
.IP \fItoVal\fP
the place to store the converted value
.LP
This function converts a callback procedure to a callback list containing
that procedure, with NULL closure data. To use this converter, include the
following in your widget's ClassInitialize procedure:
.LP
XtAddConverter(XtRCallProc, XtRCallback, XmuCvtFunctionToCallback, NULL, 0);
.sp
.FD 0
void XmuCvtStringToBackingStore(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValue *\fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
this argument is ignored
.IP \fInum_args\fP 1i
this argument must be a pointer to a Cardinal containing the value 0
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function converts a string to a backing-store integer as defined in
.Pn < X11/X.h >.
The string "notUseful" converts to
.PN NotUseful ,
"whenMapped" converts to
.PN WhenMapped ,
and "always" converts to
.PN Always .
The string "default" converts to the value
.PN Always +
.PN WhenMapped +
.PN NotUseful .
The case of the string does not matter.
To use this converter, include the following
in your widget's ClassInitialize procedure:
.LP
XtAddConverter(XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0);
.sp
.FD 0
void XmuCvtStringToBitmap(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValuePtr \fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
the sole argument specifies the Screen on which to create the bitmap
.IP \fInum_args\fP 1i
must be the value 1
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function creates a bitmap (a Pixmap of depth one) suitable for window
manager icons. The string argument is the name of a file in standard bitmap
file format. For the possible filename specifications, see
.PN XmuLocateBitmapFile .
To use this converter, include the following in your widget's
ClassInitialize procedure:
.LP
static XtConvertArgRec screenConvertArg[] = {
.br
{XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen *)}
.br
};
.LP
XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
.br
screenConvertArg, XtNumber(screenConvertArg));
.sp
.FD 0
Boolean XmuCvtStringToColorCursor(\fIdpy\fP, \fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP, \fIdata\fP)
.br
Display * \fIdpy\fP;
.br
XrmValuePtr \fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.br
XtPointer * \fIdata\fP;
.FN
.IP \fIdpy\fP 1i
specifies the display to use for conversion warnings
.IP \fIargs\fP 1i
specifies the required conversion arguments
.IP \fInum_args\fP 1i
specifies the number of required conversion arguments, which is 4
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.IP \fIdata\fP
this argument is ignored
.LP
This function converts a string to a
.PN Cursor
with the foreground and background pixels specified by the conversion
arguments. The string can either be a
standard cursor name formed by removing the ``XC_'' prefix from any of the
cursor defines listed in Appendix B of the Xlib Manual, a font name and
glyph index in decimal of the form "FONT fontname index [[font] index]",
or a bitmap filename acceptable to
.PN XmuLocateBitmapFile .
To use this converter, include
the following in the widget ClassInitialize procedure:
.LP
static XtConvertArgRec colorCursorConvertArgs[] = {
.br
{XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
sizeof(Screen *)},
{XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)},
{XtResourceString, (XtPointer) XtNpointerColorBackground, sizeof(Pixel)},
{XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap),
sizeof(Colormap)}
.br
};
.LP
XtSetTypeConverter(XtRString, XtRColorCursor, XmuCvtStringToColorCursor,
.br
colorCursorConvertArgs, XtNumber(colorCursorConvertArgs),
.br
XtCacheByDisplay, NULL);
The widget must recognize XtNpointerColor and XtNpointerColorBackground as
resources, or specify other appropriate foreground and background resources.
The widget's Realize and SetValues methods must cause the converter to be
invoked with the appropriate arguments when one of the foreground,
background, or cursor resources has changed, or when the window is created,
and must assign the cursor to the window of the widget.
.sp
.FD 0
void XmuCvtStringToCursor(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValuePtr \fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
specifies the required conversion argument, the screen
.IP \fInum_args\fP 1i
specifies the number of required conversion arguments, which is 1
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function converts a string to a
.PN Cursor .
The string can either be a
standard cursor name formed by removing the ``XC_'' prefix from any of the
cursor defines listed in Appendix B of the Xlib Manual, a font name and
glyph index in decimal of the form "FONT fontname index [[font] index]", or
a bitmap filename acceptable to
.PN XmuLocateBitmapFile .
To use this converter, include
the following in your widget's ClassInitialize procedure:
.LP
static XtConvertArgRec screenConvertArg[] = {
.br
{XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen), sizeof(Screen *)}
.br
};
.LP
XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
.br
screenConvertArg, XtNumber(screenConvertArg));
.sp
.FD 0
void XmuCvtStringToGravity(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValuePtr *\fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
this argument is ignored
.IP \fInum_args\fP 1i
this argument must be a pointer to a Cardinal containing the value 0
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function converts a string to an
.PN XtGravity
enumeration value. The string "forget" and a NULL value convert to
.PN ForgetGravity ,
"NorthWestGravity" converts to
.PN NorthWestGravity ,
the strings "NorthGravity" and "top" convert to
.PN NorthGravity ,
"NorthEastGravity" converts to
.PN NorthEastGravity ,
the strings "West" and "left" convert to
.PN WestGravity ,
"CenterGravity" converts to
.PN CenterGravity ,
"EastGravity" and "right" convert to
.PN EastGravity ,
"SouthWestGravity" converts to
.PN SouthWestGravity ,
"SouthGravity" and "bottom" convert to
.PN SouthGravity ,
"SouthEastGravity" converts to
.PN SouthEastGravity ,
"StaticGravity" converts to
.PN StaticGravity ,
and "UnmapGravity" converts to
.PN UnmapGravity .
The case of the string does not matter. To use this converter, include
the following in your widget's class initialize procedure:
.LP
XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, NULL, 0);
.sp
.FD 0
void XmuCvtStringToJustify(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValuePtr *\fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
this argument is ignored
.IP \fInum_args\fP 1i
this argument is ignored
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function converts a string to an
.PN XtJustify
enumeration value. The string "left" converts to
.PN XtJustifyLeft ,
"center" converts to
.PN XtJustifyCenter ,
and "right" converts to
.PN XtJustifyRight .
The case of the string does not matter. To use this converter,
include the following in your widget's ClassInitialize procedure:
.LP
XtAddConverter(XtRString, XtRJustify, XmuCvtStringToJustify, NULL, 0);
.sp
.FD 0
void XmuCvtStringToLong(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValuePtr \fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
this argument is ignored
.IP \fInum_args\fP 1i
this argument must be a pointer to a Cardinal containing 0
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function converts a string to an integer of type long. It parses the
string using
.PN sscanf
with a format of "%ld". To use this converter, include
the following in your widget's ClassInitialize procedure:
.LP
XtAddConverter(XtRString, XtRLong, XmuCvtStringToLong, NULL, 0);
.sp
.FD 0
void XmuCvtStringToOrientation(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValuePtr *\fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
this argument is ignored
.IP \fInum_args\fP 1i
this argument is ignored
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function converts a string to an
.PN XtOrientation
enumeration value. The string "horizontal" converts to
.PN XtorientHorizontal
and "vertical" converts to
.PN XtorientVertical .
The case of the string does not matter. To use this converter,
include the following in your widget's ClassInitialize procedure:
.LP
XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation, NULL, 0);
.sp
.FD 0
Boolean XmuCvtStringToShapeStyle(\fIdpy\fP, \fIargs\fP, \fInum_args\fP, \fIfrom\fP, \fItoVal\fP, data)
.br
Display *\fIdpy\fP;
.br
XrmValue *\fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValue *\fIfrom\fP;
.br
XrmValue *\fItoVal\fP;
.br
XtPointer *\fIdata\fP;
.FN
.IP \fIdpy\fP 1i
the display to use for conversion warnings
.IP \fIargs\fP 1i
this argument is ignored
.IP \fInum_args\fP 1i
this argument is ignored
.IP \fIfromVal\fP 1i
the value to convert from
.IP \fItoVal\fP
the place to store the converted value
.IP \fIdata\fP 1i
this argument is ignored
.LP
This function converts a string to an integer shape style. The string
"rectangle" converts to
.PN XmuShapeRectangle ,
"oval" converts to
.PN XmuShapeOval ,
"ellipse" converts to
.PN XmuShapeEllipse ,
and "roundedRectangle" converts to
.PN XmuShapeRoundedRectangle .
The case of the string does not matter. To use this converter,
include the following in your widget's ClassInitialize procedure:
.LP
XtSetTypeConverter(XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle,
.br
NULL, 0, XtCacheNone, NULL);
.sp
.FD 0
Boolean XmuReshapeWidget(w, \fIshape_style\fP, \fIcorner_width\fP, \fIcorner_height\fP)
.br
Widget \fIw\fP;
.br
int \fIshape_style\fP;
.br
int \fIcorner_width\fP, \fIcorner_height\fP;
.FN
.IP \fIw\fP 1i
specifies the widget to reshape
.IP \fIshape_style\fP 1i
specifies the new shape
.IP \fIcorner_width\fP 1i
specifies the width of the rounded rectangle corner
.IP \fIcorner_height\fP 1i
specified the height of the rounded rectangle corner
.LP
This function reshapes the specified widget, using the Shape extension, to a
rectangle, oval, ellipse, or rounded rectangle, as specified by shape_style
(
.PN XmuShapeRectangle ,
.PN XmuShapeOval ,
.PN XmuShapeEllipse ,
and
.PN XmuShapeRoundedRectangle ,
respectively).
The shape is bounded by the outside edges of the rectangular extents of the
widget. If the shape is a rounded rectangle, corner_width and corner_height
specify the size of the bounding box that the corners are drawn inside of
(see
.PN XmuFillRoundedRectangle );
otherwise, corner_width and corner_height are ignored.
The origin of the widget within its parent remains unchanged.
.sp
.FD 0
void XmuCvtStringToWidget(\fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP)
.br
XrmValuePtr \fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValuePtr \fIfromVal\fP;
.br
XrmValuePtr \fItoVal\fP;
.FN
.IP \fIargs\fP 1i
this sole argument is the parent Widget
.IP \fInum_args\fP 1i
this argument must be 1
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.LP
This function converts a string to an immediate child widget of the parent
widget passed as an argument. Note that this converter only works for
child widgets that have already been created; there is no lazy evaluation.
The string is first compared against the
names of the normal and popup children, and if a match is found the
corresponding child is returned. If no match is found, the string is
compared against the classes of the normal and popup children, and if a
match is found the corresponding child is returned. The case of the string
is significant. To use this converter, include the following in your
widget's ClassInitialize procedure:
.LP
static XtConvertArgRec parentCvtArg[] = {
.br
{XtBaseOffset, (XtPointer)XtOffset(Widget, core.parent), sizeof(Widget)},
.br
};
.LP
XtAddConverter(XtRString, XtRWidget, XmuCvtStringToWidget,
.br
parentCvtArg, XtNumber(parentCvtArg));
.sp
.FD 0
Boolean XmuNewCvtStringToWidget(\fIdpy\fP, \fIargs\fP, \fInum_args\fP, \fIfromVal\fP, \fItoVal\fP, \fIdata\fP)
.br
Display *\fIdpy\fP;
.br
XrmValue * \fIargs\fP;
.br
Cardinal *\fInum_args\fP;
.br
XrmValue * \fIfromVal\fP;
.br
XrmValue * \fItoVal\fP;
.br
XtPointer *\fIdata\fP;
.FN
.IP \fIdpy\fP 1i
the display to use for conversion warnings
.IP \fIargs\fP 1i
this sole argument is the parent Widget
.IP \fInum_args\fP 1i
this argument must be a pointer to a Cardinal containing the value 1
.IP \fIfromVal\fP 1i
specifies the string to convert
.IP \fItoVal\fP
returns the converted value
.IP \fIdata\fP 1i
this argument is ignored
.LP
This converter is identical in functionality to XmuCvtStringToWidget, except
that it is a new-style converter, allowing the specification of a cache type
at the time of registration.
Most widgets will not cache the conversion results, as the application may
dynamically create and destroy widgets, which would cause cached values to
become illegal. To use this converter, include the following in the widget's
class initialize procedure:
.LP
static XtConvertArgRec parentCvtArg[] = {
.br
{XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent),
.br
sizeof(Widget)}
.br
};
.LP
XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtStringToWidget,
.br
parentCvtArg, XtNumber(parentCvtArg), XtCacheNone, NULL);
.LP
.NH 1
Character Set Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/CharSet.h >.
.LP
The functions in this section are \fBdeprecated\fP because they don't work
in most locales now supported by X11; the function
.PN XmbLookupString
provides a better alternative.
.sp
.FD 0
void XmuCopyISOLatin1Lowered(\fIdst\fP, \fIsrc\fP)
.br
char *\fIdst\fP, *\fIsrc\fP;
.FN
.IP \fIdst\fP 1i
returns the string copy
.IP \fIsrc\fP 1i
specifies the string to copy
.LP
This function copies a null terminated string from src to dst (including the
null), changing all Latin-1 uppercase letters to lowercase. The string is
assumed to be encoded using ISO 8859-1.
.sp
.FD 0
void XmuCopyISOLatin1Uppered(\fIdst\fP, \fIsrc\fP)
.br
char *\fIdst\fP, *\fIsrc\fP;
.FN
.IP \fIdst\fP 1i
returns the string copy
.IP \fIsrc\fP 1i
specifies the string to copy
.LP
This function copies a null terminated string from src to dst (including the
null), changing all Latin-1 lowercase letters to uppercase. The string is
assumed to be encoded using ISO 8859-1.
.sp
.FD 0
int XmuCompareISOLatin1(\fIfirst\fP, \fIsecond\fP)
.br
char *\fIfirst\fP, *\fIsecond\fP;
.FN
.IP \fIdst\fP 1i
specifies a string to compare
.IP \fIsrc\fP 1i
specifies a string to compare
.LP
This function compares two null terminated Latin-1 strings, ignoring case
differences, and returns an integer greater than, equal to, or less than 0,
according to whether first is lexicographically greater than, equal to, or
less than second. The two strings are assumed to be encoded using ISO
8859-1.
.sp
.FD 0
int XmuLookupLatin1(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is identical to
.PN XLookupString ,
and exists only for naming symmetry with other functions.
.sp
.FD 0
int XmuLookupLatin2(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to an Latin-2 (ISO 8859-2) string, or to an ASCII control string.
.sp
.FD 0
int XmuLookupLatin3(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to an Latin-3 (ISO 8859-3) string, or to an ASCII control string.
.sp
.FD 0
int XmuLookupLatin4(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to an Latin-4 (ISO 8859-4) string, or to an ASCII control string.
.sp
.FD 0
int XmuLookupKana(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to a string in an encoding consisting of Latin-1 (ISO 8859-1) and ASCII
control in the Graphics Left half (values 0 to 127), and Katakana in the
Graphics Right half (values 128 to 255), using the values from JIS
X201-1976.
.sp
.FD 0
int XmuLookupJISX0201(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to a string in the JIS X0201-1976 encoding, including ASCII control.
.sp
.FD 0
int XmuLookupArabic(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to a Latin/Arabic (ISO 8859-6) string, or to an ASCII control string.
.sp
.FD 0
int XmuLookupCyrillic(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to a Latin/Cyrillic (ISO 8859-5) string, or to an ASCII control string.
.sp
.FD 0
int XmuLookupGreek(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to a Latin/Greek (ISO 8859-7) string, or to an ASCII control string.
.sp
.FD 0
int XmuLookupHebrew(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event
to a Latin/Hebrew (ISO 8859-8) string, or to an ASCII control string.
.sp
.FD 0
int XmuLookupAPL(\fIevent\fP, \fIbuffer\fP, \fInbytes\fP, \fIkeysym\fP, \fIstatus\fP)
.br
XKeyEvent *\fIevent\fP;
.br
char *\fIbuffer\fP;
.br
int \fInbytes\fP;
.br
KeySym *\fIkeysym\fP;
.br
XComposeStatus *\fIstatus\fP;
.FN
.IP \fIevent\fP 1i
specifies the key event
.IP \fIbuffer\fP 1i
returns the translated characters
.IP \fInbytes\fP 1i
specifies the length of the buffer
.IP \fIkeysym\fP 1i
returns the computed KeySym, or None
.IP \fIstatus\fP 1i
specifies or returns the compose state
.LP
This function is similar to
.PN XLookupString ,
except that it maps a key event to an APL string.
.LP
.NH 1
Compound Text Functions
.LP
The functions defined in this section are for parsing Compound Text strings,
decomposing them into individual segments. Definitions needed to use these
routines are in the include file
.Pn < X11/Xmu/Xct.h >.
.LP
The functions in this section are \fBdeprecated\fP because they shift the
burden for recently introduced locale encodings to the application. The
use of the
.PN UTF8_STRING
text encoding provides a better alternative.
.LP
A Compound Text string is represented as the following type:
.LP
typedef unsigned char *XctString;
.sp
.FD 0
XctData XctCreate(\fIstring\fP, \fIlength\fP, \fIflags\fP)
.br
XctString \fIstring\fP;
.br
int \fIlength\fP;
.br
XctFlags \fIflags\fP;
.FN
.IP \fIstring\fP 1i
the Compound Text string
.IP \fIlength\fP 1i
the number of bytes in string
.IP \fIflags\fP 1i
parsing control flags
.LP
This function creates an
.PN XctData
structure for parsing a Compound Text
string. The string need not be null terminated. The following flags are
defined to control parsing of the string:
.LP
.PN XctSingleSetSegments
-- This means that returned segments should contain
characters from only one set (C0, C1, GL, GR). When this is requested,
.PN XctSegment
is never returned by
.PN XctNextItem ,
instead
.PN XctC0Segment ,
.PN XctC1Segment ,
.PN XctGlSegment ,
and
.PN XctGRSegment
are returned. C0 and C1
segments are always returned as singleton characters.
.LP
.PN XctProvideExtensions
-- This means that if the Compound Text string is from a
higher version than this code is implemented to, then syntactically correct
but unknown control sequences should be returned as
.PN XctExtension
items by
.PN XctNextItem .
If this flag is not set, and the Compound Text string version
indicates that extensions cannot be ignored, then each unknown control
sequence will be reported as an
.PN XctError .
.LP
.PN XctAcceptC0Extensions
-- This means that if the Compound Text string is from
a higher version than this code is implemented to, then unknown C0
characters should be treated as if they were legal, and returned as C0
characters (regardless of how
.PN XctProvideExtensions
is set) by
.PN XctNextItem .
If this flag is not set, then all unknown C0 characters are treated
according to
.PN XctProvideExtensions .
.LP
.PN XctAcceptC1Extensions
-- This means that if the Compound Text string is from
a higher version than this code is implemented to, then unknown C1
characters should be treated as if they were legal, and returned as C1
characters (regardless of how
.PN XctProvideExtensions
is set) by
.PN XctNextItem .
If this flag is not set, then all unknown C1 characters are treated
according to
.PN XctProvideExtensions .
.LP
.PN XctHideDirection
-- This means that horizontal direction changes should be
reported as
.PN XctHorizontal
items by
.PN XctNextItem . If this flag is not set,
then direction changes are not returned as items, but the current direction
is still maintained and reported for other items. The current direction is
given as an enumeration, with the values
.PN XctUnspecified ,
.PN XctLeftToRight ,
and
.PN XctRightToLeft .
.LP
.PN XctFreeString
-- This means that
.PN XctFree
should free the Compound Text string that is passed to
.PN XctCreate .
If this flag is not set, the string is not freed.
.LP
.PN XctShiftMultiGRToGL
-- This means that
.PN XctNextItem
should translate GR
segments on-the-fly into GL segments for the GR sets: GB2312.1980-1,
JISX0208.1983-1, and KSC5601.1987-1.
.sp
.FD 0
void XctReset(\fIdata\fP)
.br
XctData \fIdata\fP;
.FN
.IP \fIdata\fP 1i
specifies the Compound Text structure
.LP
This function resets the
.PN XctData
structure to reparse the Compound Text string from the beginning.
.sp
.FD 0
XctResult XctNextItem(\fIdata\fP)
.br
XctData \fIdata\fP;
.FN
.IP \fIdata\fP 1i
specifies the Compound Text structure
.LP
This function parses the next ``item'' from the Compound Text string. The
return value indicates what kind of item is returned. The item itself, it's
length, and the current contextual state, are reported as components of the
.PN XctData
structure.
.PN XctResult
is an enumeration, with the following values:
.LP
.PN XctSegment
-- the item contains some mixture of C0, GL, GR, and C1 characters.
.LP
.PN XctC0Segment
-- the item contains only C0 characters.
.LP
.PN XctGLSegment
-- the item contains only GL characters.
.LP
.PN XctC1Segment
-- the item contains only C1 characters.
.LP
.PN XctGRSegment
-- the item contains only GR characters.
.LP
.PN XctExtendedSegment
-- the item contains an extended segment.
.LP
.PN XctExtension
-- the item is an unknown extension control sequence.
.LP
.PN XctHorizontal
-- the item indicates a change in horizontal direction or
depth. The new direction and depth are recorded in the
.PN XctData
structure.
.LP
.PN XctEndOfText
-- The end of the Compound Text string has been reached.
.LP
.PN XctError
-- the string contains a syntactic or semantic error; no further
parsing should be performed.
.LP
The following state values are stored in the
.PN XctData
structure:
.Ds 0
.TA .5i 3i
.ta .5i 3i
XctString item; /* the action item */
int item_length; /* the length of item in bytes */
int char_size; /* the number of bytes per character in
* item, with zero meaning variable */
char *encoding; /* the XLFD encoding name for item */
XctHDirection horizontal; /* the direction of item */
int horz_depth; /* the current direction nesting depth */
char *GL; /* the "{I} F" string for the current GL */
char *GL_encoding; /* the XLFD encoding name for the current GL */
int GL_set_size; /* 94 or 96 */
int GL_char_size; /* the number of bytes per GL character */
char *GR; /* the "{I} F" string for the current GR */
char *GR_encoding; /* the XLFD encoding name the for current GR */
int GR_set_size; /* 94 or 96 */
int GR_char_size; /* the number of bytes per GR character */
char *GLGR_encoding; /* the XLFD encoding name for the current
* GL+GR, if known */
.De
.sp
.FD 0
void XctFree(\fIdata\fP)
.br
XctData \fIdata\fP;
.FN
.IP \fIdata\fP 1i
specifies the Compound Text structure
.LP
This function frees all data associated with the
.PN XctData
structure.
.LP
.NH 1
CloseDisplay Hook Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/CloseHook.h >.
.sp
.FD 0
CloseHook XmuAddCloseDisplayHook(\fIdpy\fP, \fIfunc\fP, \fIarg\fP)
.br
Display *\fIdpy\fP;
.br
int (*\fIfunc\fP)();
.br
caddr_t \fIarg\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIfunc\fP 1i
specifies the function to call at display close
.IP \fIarg\fP 1i
specifies arbitrary data to pass to func
.LP
This function adds a callback for the given display. When the display is
closed, the given function will be called with the given display and
argument as:
.LP
(*func)(dpy, arg)
.LP
The function is declared to return an int even though the value is ignored,
because some compilers have problems with functions returning void.
.LP
This routine returns NULL if it was unable to add the callback, otherwise it
returns an opaque handle that can be used to remove or lookup the callback.
.sp
.FD 0
Bool XmuRemoveCloseDisplayHook(\fIdpy\fP, \fIhandle\fP, \fIfunc\fP, \fIarg\fP)
.br
Display *\fIdpy\fP;
.br
CloseHook \fIhandle\fP;
.br
int (*\fIfunc\fP)();
.br
caddr_t \fIarg\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIhandle\fP 1i
specifies the callback by id, or NULL
.IP \fIfunc\fP 1i
specifies the callback by function
.IP \fIarg\fP 1i
specifies the function data to match
.LP
This function deletes a callback that has been added with
.PN XmuAddCloseDisplayHook .
If handle is not NULL, it specifies the callback to
remove, and the func and arg parameters are ignored. If handle is NULL, the
first callback found to match the specified func and arg will be removed.
Returns
.PN True
if a callback was removed, else returns
.PN False .
.sp
.FD 0
Bool XmuLookupCloseDisplayHook(\fIdpy\fP, \fIhandle\fP, \fIfunc\fP, \fIarg\fP)
.br
Display *\fIdpy\fP;
.br
CloseHook \fIhandle\fP;
.br
int (*\fIfunc\fP)();
.br
caddr_t \fIarg\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIhandle\fP 1i
specifies the callback by id, or NULL
.IP \fIfunc\fP 1i
specifies the callback by function
.IP \fIarg\fP 1i
specifies the function data to match
.LP
This function determines if a callback is installed. If handle is not NULL,
it specifies the callback to look for, and the func and arg parameters are
ignored. If handle is NULL, the function will look for any callback for the
specified func and arg. Returns
.PN True
if a matching callback exists, else returns
.PN False .
.LP
.NH 1
Display Queue Functions
.LP
To use the functions and types defined in this section, you should include the
header file
.Pn < X11/Xmu/DisplayQue.h >.
It defines the following types:
.LP
.Ds 0
.TA .5i 3i
.ta .5i 3i
typedef struct _XmuDisplayQueueEntry {
struct _XmuDisplayQueueEntry *prev, *next;
Display *display;
CloseHook closehook;
caddr_t data;
} XmuDisplayQueueEntry;
typedef struct _XmuDisplayQueue {
int nentries;
XmuDisplayQueueEntry *head, *tail;
int (*closefunc)();
int (*freefunc)();
caddr_t data;
} XmuDisplayQueue;
.De
.sp
.FD 0
XmuDisplayQueue *XmuDQCreate(\fIclosefunc\fP, \fIfreefunc\fP, \fIdata\fP)
.br
int (*\fIclosefunc\fP)();
.br
int (*\fIfreefunc\fP)();
.br
caddr_t \fIdata\fP;
.FN
.IP \fIclosefunc\fP 1i
specifies the close function
.IP \fIfreefunc\fP 1i
specifies the free function
.IP \fIdata\fP 1i
specifies private data for the functions
.LP
This function creates and returns an empty
.PN XmuDisplayQueue
(which is really just a set of displays, but is called a queue for
historical reasons). The queue is initially empty, but displays
can be added using
.PN XmuAddDisplay .
The data value is simply stored in the queue for use by the closefunc
and freefunc callbacks.
Whenever a display in the queue is closed using
.PN XCloseDisplay ,
the closefunc (if non-NULL) is called with the queue and the display's
.PN XmuDisplayQueueEntry
as follows:
.LP
(*closefunc)(queue, entry)
.LP
The freeproc (if non-NULL) is called whenever the last display in the
queue is closed, as follows:
.LP
(*freefunc)(queue)
.LP
The application is responsible for actually freeing the queue, by calling
.PN XmuDQDestroy .
.sp
.FD 0
XmuDisplayQueueEntry *XmuDQAddDisplay(\fIq\fP, \fIdpy\fP, \fIdata\fP)
.br
XmuDisplayQueue *\fIq\fP;
.br
Display *\fIdpy\fP;
.br
caddr_t \fIdata\fP;
.FN
.IP \fIq\fP 1i
specifies the queue
.IP \fIdpy\fP 1i
specifies the display to add
.IP \fIdata\fP 1i
specifies private data for the free function
.LP
This function adds the specified display to the queue. If successful,
the queue entry is returned, otherwise NULL is returned.
The data value is simply stored in the queue entry for use by the
queue's freefunc callback. This function does not attempt to prevent
duplicate entries in the queue; the caller should use
.PN XmuDQLookupDisplay
to determine if a display has already been added to a queue.
.sp
.FD 0
XmuDisplayQueueEntry *XmuDQLookupDisplay(\fIq\fP, \fIdpy\fP)
.br
XmuDisplayQueue *\fIq\fP;
.br
Display *\fIdpy\fP;
.FN
.IP \fIq\fP 1i
specifies the queue
.IP \fIdpy\fP 1i
specifies the display to lookup
.LP
This function returns the queue entry for the specified display, or NULL if
the display is not in the queue.
.sp
.FD 0
XmuDQNDisplays(\fIq\fP)
.FN
.LP
This macro returns the number of displays in the specified queue.
.sp
.FD 0
Bool XmuDQRemoveDisplay(\fIq\fP, \fIdpy\fP)
.br
XmuDisplayQueue *\fIq\fP;
.br
Display *\fIdpy\fP;
.FN
.IP \fIq\fP 1i
specifies the queue
.IP \fIdpy\fP 1i
specifies the display to remove
.LP
This function removes the specified display from the specified queue.
No callbacks are performed.
If the display is not found in the queue,
.PN False
is returned, otherwise
.PN True
is returned.
.sp
.FD 0
Bool XmuDQDestroy(\fIq\fP, \fIdocallbacks\fP)
.br
XmuDisplayQueue *\fIq\fP;
.br
Bool \fIdocallbacks\fP;
.FN
.IP \fIq\fP 1i
specifies the queue to destroy
.IP \fIdocallbacks\fP 1i
specifies whether close functions should be called
.LP
This function releases all memory associated with the specified queue.
If docallbacks is
.PN True ,
then the queue's closefunc callback (if non-NULL) is first called
for each display in the queue, even though
.PN XCloseDisplay
is not called on the display.
.LP
.NH 1
Toolkit Convenience Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/Initer.h >.
.sp
.FD 0
void XmuAddInitializer(\fIfunc\fP, \fIdata\fP)
.br
void (*\fIfunc\fP)();
.br
caddr_t \fIdata\fP;
.FN
.IP \fIfunc\fP 1i
specifies the procedure to register
.IP \fIdata\fP 1i
specifies private data for the procedure
.LP
This function registers a procedure, to be invoked the first time
.PN XmuCallInitializers
is called on a given application context. The procedure
is called with the application context and the specified data:
.LP
(*func)(app_con, data)
.sp
.FD 0
void XmuCallInitializers(\fIapp_con\fP)
.br
XtAppContext \fIapp_con\fP;
.FN
.IP \fIapp_con\fP 1i
specifies the application context to initialize
.LP
This function calls each of the procedures that have been registered with
.PN XmuAddInitializer ,
if this is the first time the application context has been passed to
.PN XmuCallInitializers .
Otherwise, this function does nothing.
.LP
.NH 1
Standard Colormap Functions
.LP
To use the functions defined in this section, you should include the header
file
.Pn < X11/Xmu/StdCmap.h >.
.sp
.FD 0
Status XmuAllStandardColormaps(\fIdpy\fP)
.br
Display *\fIdpy\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.LP
To create all of the appropriate standard colormaps for every visual of
every screen on a given display, use
.PN XmuAllStandardColormaps .
.LP
This function defines and retains as permanent resources all standard
colormaps which are meaningful for the visuals of each screen of the
display. It returns 0 on failure, non-zero on success. If the property of
any standard colormap is already defined, this function will redefine it.
.LP
This function is intended to be used by window managers or a special client
at the start of a session.
.LP
The standard colormaps of a screen are defined by properties associated with
the screen's root window. The property names of standard colormaps are
predefined, and each property name except RGB_DEFAULT_MAP may describe at
most one colormap.
.LP
The standard colormaps are: RGB_BEST_MAP, RGB_RED_MAP, RGB_GREEN_MAP,
RGB_BLUE_MAP, RGB_DEFAULT_MAP, and RGB_GRAY_MAP. Therefore a screen may
have at most 6 standard colormap properties defined.
.LP
A standard colormap is associated with a particular visual of the screen. A
screen may have multiple visuals defined, including visuals of the same
class at different depths. Note that a visual id might be repeated for more
than one depth, so the visual id and the depth of a visual identify the
visual. The characteristics of the visual will determine which standard
colormaps are meaningful under that visual, and will determine how the
standard colormap is defined. Because a standard colormap is associated
with a specific visual, there must be a method of determining which visuals
take precedence in defining standard colormaps.
.LP
The method used here is: for the visual of greatest depth, define all
standard colormaps meaningful to that visual class, according to this order
of (descending) precedence:
.PN DirectColor ;
.PN PseudoColor ;
.PN TrueColor
and
.PN GrayScale ;
and finally
.PN StaticColor
and
.PN StaticGray .
.LP
This function allows success, on a per screen basis. For example, if a map
on screen 1 fails, the maps on screen 0, created earlier, will remain.
However, none on screen 1 will remain. If a map on screen 0 fails, none
will remain.
.LP
See
.PN XmuVisualStandardColormaps
for which standard colormaps are meaningful under these classes of visuals.
.sp
.FD 0
Status XmuVisualStandardColormaps(\fIdpy\fP, \fIscreen\fP, \fIvisualid\fP, \fIdepth\fP, \fIreplace\fP, \fIretain\fP)
.br
Display *\fIdpy\fP;
.br
int \fIscreen\fP;
.br
VisualID \fIvisualid\fP;
.br
unsigned int \fIdepth\fP;
.br
Bool \fIreplace\fP;
.br
Bool \fIretain\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIscreen\fP 1i
specifies the screen of the display
.IP \fIvisualid\fP 1i
specifies the visual type
.IP \fIdepth\fP 1i
specifies the visual depth
.IP \fIreplace\fP 1i
specifies whether or not to replace
.IP \fIretain\fP 1i
specifies whether or not to retain
.LP
To create all of the appropriate standard colormaps for a given visual on a
given screen, use
.PN XmuVisualStandardColormaps .
.LP
This function defines all appropriate standard colormap properties for the
given visual. If replace is
.PN True ,
any previous definition will be removed.
If retain is
.PN True ,
new properties will be retained for the duration of the
server session. This function returns 0 on failure, non-zero on success.
On failure, no new properties will be defined, but old ones may have been
removed if replace was True.
.LP
Not all standard colormaps are meaningful to all visual classes. This
routine will check and define the following properties for the following
classes, provided that the size of the colormap is not too small. For
.PN DirectColor
and
.PN PseudoColor :
RGB_DEFAULT_MAP, RGB_BEST_MAP, RGB_RED_MAP,
RGB_GREEN_MAP, RGB_BLUE_MAP, and RGB_GRAY_MAP. For
.PN TrueColor
and
.PN StaticColor :
RGB_BEST_MAP. For
.PN GrayScale
and
.PN StaticGray :
RGB_GRAY_MAP.
.sp
.FD 0
Status XmuLookupStandardColormap(\fIdpy\fP, \fIscreen\fP, \fIvisualid\fP, \fIdepth\fP, \fIproperty\fP, \fIreplace\fP, \fIretain\fP)
.br
Display *\fIdpy\fP;
.br
int \fIscreen\fP;
.br
VisualID \fIvisualid\fP;
.br
unsigned int \fIdepth\fP;
.br
Atom \fIproperty\fP;
.br
Bool \fIreplace\fP;
.br
Bool \fIretain\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIscreen\fP 1i
specifies the screen of the display
.IP \fIvisualid\fP 1i
specifies the visual type
.IP \fIdepth\fP 1i
specifies the visual depth
.IP \fIproperty\fP 1i
specifies the standard colormap property
.IP \fIreplace\fP 1i
specifies whether or not to replace
.IP \fIretain\fP 1i
specifies whether or not to retain
.LP
To create a standard colormap if one does not currently exist, or replace
the currently existing standard colormap, use
.PN XmuLookupStandardColormap .
.LP
Given a screen, a visual, and a property, this function will determine the
best allocation for the property under the specified visual, and determine
the whether to create a new colormap or to use the default colormap of the
screen.
.LP
If replace is True, any previous definition of the property will be
replaced. If retain is True, the property and the colormap will be made
permanent for the duration of the server session. However, pre-existing
property definitions which are not replaced cannot be made permanent by a
call to this function; a request to retain resources pertains to newly
created resources.
.LP
This function returns 0 on failure, non-zero on success. A request to
create a standard colormap upon a visual which cannot support such a map is
considered a failure. An example of this would be requesting any standard
colormap property on a monochrome visual, or, requesting an RGB_BEST_MAP on
a display whose colormap size is 16.
.sp
.FD 0
Status XmuGetColormapAllocation(\fIvinfo\fP, \fIproperty\fP, \fIred_max\fP, \fIgreen_max\fP, \fIblue_max\fP)
.br
XVisualInfo *\fIvinfo\fP;
.br
Atom \fIproperty\fP;
.br
unsigned long *\fIred_max\fP, *\fIgreen_max\fP, *\fIblue_max\fP;
.FN
.IP \fIvinfo\fP 1i
specifies visual information for a chosen visual
.IP \fIproperty\fP 1i
specifies one of the standard colormap property names
.IP \fIred_max\fP 1i
returns maximum red value
.IP \fIgreen_max\fP 1i
returns maximum green value
.IP \fIblue_max\fP 1i
returns maximum blue value
.LP
To determine the best allocation of reds, greens, and blues in a standard
colormap, use
.PN XmuGetColormapAllocation .
.LP
.PN XmuGetColormapAllocation
returns 0 on failure, non-zero on success. It is
assumed that the visual is appropriate for the colormap property.
.sp
.FD 0
XStandardColormap *XmuStandardColormap(\fIdpy\fP, \fIscreen\fP, \fIvisualid\fP, \fIdepth\fP, \fIproperty\fP,
\fIcmap\fP, \fIred_max\fP, \fIgreen_max\fP, \fIblue_max\fP)
.br
Display \fIdpy\fP;
.br
int \fIscreen\fP;
.br
VisualID \fIvisualid\fP;
.br
unsigned int \fIdepth\fP;
.br
Atom \fIproperty\fP;
.br
Colormap \fIcmap\fP;
.br
unsigned long \fIred_max\fP, \fIgreen_max\fP, \fIblue_max\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIscreen\fP 1i
specifies the screen of the display
.IP \fIvisualid\fP 1i
specifies the visual type
.IP \fIdepth\fP 1i
specifies the visual depth
.IP \fIproperty\fP 1i
specifies the standard colormap property
.IP \fIcmap\fP 1i
specifies the colormap ID, or None
.IP \fIred_max\fP 1i
specifies the red allocation
.IP \fIgreen_max\fP 1i
specifies the green allocation
.IP \fIblue_max\fP 1i
specifies the blue allocation
.LP
To create any one standard colormap, use
.PN XmuStandardColormap .
.LP
This function creates a standard colormap for the given screen, visualid,
and visual depth, with the given red, green, and blue maximum values, with
the given standard property name. Upon success, it returns a pointer to an
.PN XStandardColormap
structure which describes the newly created colormap.
Upon failure, it returns NULL.
If cmap is the default colormap of the screen, the standard colormap
will be defined on the default colormap; otherwise a new colormap is created.
.LP
Resources created by this function are not made permanent; that is the
caller's responsibility.
.sp
.FD 0
Status XmuCreateColormap(\fIdpy\fP, \fIcolormap\fP)
.br
Display *\fIdpy\fP;
.br
XStandardColormap *\fIcolormap\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection under which the map is created
.IP \fIcolormap\fP 1i
specifies the map to be created
.LP
To create any one colormap which is described by an
.PN XStandardColormap
structure, use
.PN XmuCreateColormap .
.LP
This function returns 0 on failure, and non-zero on success. The base_pixel
of the colormap is set on success. Resources created by this function are
not made permanent. No argument error checking is provided; use at your own
risk.
.LP
All colormaps are created with read-only allocations, with the exception of
read-only allocations of colors which fail
to return the expected pixel value, and these are individually defined as
read/write allocations. This is done so that all the cells defined in the
colormap are contiguous, for use in image processing. This typically
happens with White and Black in the default map.
.LP
Colormaps of static visuals are considered to be successfully created if the
map of the static visual matches the definition given in the standard
colormap structure.
.sp
.FD 0
void XmuDeleteStandardColormap(\fIdpy\fP, \fIscreen\fP, \fIproperty\fP)
.br
Display *\fIdpy\fP;
.br
int \fIscreen\fP;
.br
Atom \fIproperty\fP;
.FN
.IP \fIdpy\fP 1i
specifies the connection to the X server
.IP \fIscreen\fP 1i
specifies the screen of the display
.IP \fIproperty\fP 1i
specifies the standard colormap property
.LP
To remove any standard colormap property, use
.PN XmuDeleteStandardColormap .
This function will remove the specified property from the specified screen,
releasing any resources used by the colormap(s) of the property, if
possible.
.LP
.NH 1
Widget Description Functions
.LP
The functions defined in this section are for building a description of
the structure of and resources associated with a hierarchy of widget classes.
This package is typically used by applications that wish to manipulate the
widget set itself.
.LP
The definitions needed to use these interfaces are in the header file
.Pn < X11/Xmu/WidgetNode.h >.
The following function must be called before any of the others described
below:
.sp
.FD 0
void XmuWnInitializeNodes(\fInode_array\fP, \fInum_nodes\fP)
.br
XmuWidgetNode *\fInode_array\fP;
.br
int \fInum_nodes\fP;
.FN
.IP \fInode_array\fP 1i
specifies a list of widget classes, in alphabetical order
.IP \fInum_nodes\fP 1i
specfies the number of widget classes in the node array
.LP
To determine the resources provided by a widget class or classes, use
.sp
.FD 0
void XmuWnFetchResources(\fInode\fP, \fItoplevel\fP, \fItop_node\fP)
.br
XmuWidgetNode *\fInode\fP;
.br
Widget \fItoplevel\fP;
.br
XmuWidgetNode *\fItop_node\fP;
.FN
.IP \fInode\fP 1i
specifies the widget class for which resources should be obtained.
.IP \fItoplevel\fP 1i
specifies the widget that should be used for creating an instance of \fInode\fP
from which resources are extracted. This is typically the value returned
by \fBXtAppInitialize\fP.
.IP \fItop_node\fP 1i
specifies the ancestor of \fInode\fP that should be treated as the root
of the widget inheritance tree (used in determining which ancestor contributed
which resources).
.LP
Each widget class inherits the resources of its parent. To count the number
of resources contributed by a particular widget class, use:
.sp
.FD 0
int XmuWnCountOwnedResources(\fInode\fP, \fIowner_node\fP, \fIconstraints\fP)
.br
XmuWidgetNode *\fInode\fP;
.br
XmuWidgetNode *\fIowner_node\fP;
.br
Bool \fIconstraints\fP;
.FN
.IP \fInode\fP 1i
specifies the widget class whose resources are being examined.
.IP \fIowner_node\fP 1i
specifies the widget class of the ancestor of \fInode\fP whose contributions
are being counted.
.IP \fIconstraints\fP 1i
specifies whether or not to count constraint resources or normal resources.
.LP
This routine returns the number of resources contributed (or ``owned'') by
the specified widget class.
.sp
.FD 0
XmuWidgetNode *XmuWnNameToNode(\fInode_list\fP, \fInum_nodes\fP, \fIname\fP)
.br
XmuWidgetNode *\fInode_list\fP;
int \fInum_nodes\fP;
char *\fIname\fP;
.FN
.IP \fInode_list\fP 1i
specifies a list of widget nodes
.IP \fInum_nodes\fP 1i
specifies the number of nodes in the list
.IP \fIname\fP 1i
specifies the name of the widget class in the node list to search for
.LP
This function returns the WidgetNode in the list that matches the given
widget name or widget class name. If no match is found, it returns NULL.
.LP
.NH 1
Participation in the Editres Protocol
.LP
To participate in the editres protocol, applications which are not based
on the Athena widget set should include the header file
.Pn < X11/Xmu/Editres.h >.
.LP
To participate in the editres protocol, Xt applications which do not rely
on the Athena widget set should register the editres protocol handler on
each shell widget in the application, specifying an event mask of 0,
nonmaskable events, and client data as NULL:
.LP
XtAddEventHandler(shell, (EventMask) 0, True, _XEditResCheckMessages, NULL);
|