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
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT #[cfg(any(feature = "v3_24", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] use crate::AnchorHints; use crate::Cursor; use crate::Device; use crate::Display; use crate::DragProtocol; #[cfg(any(feature = "v3_22", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] use crate::DrawingContext; use crate::Event; use crate::EventMask; use crate::FrameClock; use crate::FullscreenMode; use crate::GLContext; use crate::Geometry; #[cfg(any(feature = "v3_24", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] use crate::Gravity; use crate::InputSource; use crate::ModifierType; use crate::Rectangle; use crate::Screen; use crate::Visual; use crate::WMDecoration; use crate::WMFunction; use crate::WindowEdge; use crate::WindowHints; use crate::WindowState; use crate::WindowType; use crate::WindowTypeHint; use crate::RGBA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use std::boxed::Box as Box_; use std::fmt; use std::mem; use std::mem::transmute; use std::ptr; glib::wrapper! { /// /// /// This is an Abstract Base Class, you cannot instantiate it. /// /// # Implements /// /// [`WindowExtManual`][trait@crate::prelude::WindowExtManual] #[doc(alias = "GdkWindow")] pub struct Window(Object<ffi::GdkWindow, ffi::GdkWindowClass>); match fn { type_ => || ffi::gdk_window_get_type(), } } impl Window { //#[doc(alias = "gdk_window_add_filter")] //pub fn add_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>) { // unsafe { TODO: call ffi:gdk_window_add_filter() } //} /// Emits a short beep associated to `self` in the appropriate /// display, if supported. Otherwise, emits a short beep on /// the display just as [`Display::beep()`][crate::Display::beep()]. #[doc(alias = "gdk_window_beep")] pub fn beep(&self) { unsafe { ffi::gdk_window_beep(self.to_glib_none().0); } } /// Indicates that you are beginning the process of redrawing `region` /// on `self`, and provides you with a [`DrawingContext`][crate::DrawingContext]. /// /// If `self` is a top level [`Window`][crate::Window], backed by a native window /// implementation, a backing store (offscreen buffer) large enough to /// contain `region` will be created. The backing store will be initialized /// with the background color or background surface for `self`. Then, all /// drawing operations performed on `self` will be diverted to the /// backing store. When you call `gdk_window_end_frame()`, the contents of /// the backing store will be copied to `self`, making it visible /// on screen. Only the part of `self` contained in `region` will be /// modified; that is, drawing operations are clipped to `region`. /// /// The net result of all this is to remove flicker, because the user /// sees the finished product appear all at once when you call /// [`end_draw_frame()`][Self::end_draw_frame()]. If you draw to `self` directly without /// calling [`begin_draw_frame()`][Self::begin_draw_frame()], the user may see flicker /// as individual drawing operations are performed in sequence. /// /// When using GTK+, the widget system automatically places calls to /// [`begin_draw_frame()`][Self::begin_draw_frame()] and [`end_draw_frame()`][Self::end_draw_frame()] around /// emissions of the `GtkWidget::draw` signal. That is, if you’re /// drawing the contents of the widget yourself, you can assume that the /// widget has a cleared background, is already set as the clip region, /// and already has a backing store. Therefore in most cases, application /// code in GTK does not need to call [`begin_draw_frame()`][Self::begin_draw_frame()] /// explicitly. /// ## `region` /// a Cairo region /// /// # Returns /// /// a [`DrawingContext`][crate::DrawingContext] context that should be /// used to draw the contents of the window; the returned context is owned /// by GDK. #[cfg(any(feature = "v3_22", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] #[doc(alias = "gdk_window_begin_draw_frame")] pub fn begin_draw_frame(&self, region: &cairo::Region) -> Option<DrawingContext> { unsafe { from_glib_none(ffi::gdk_window_begin_draw_frame( self.to_glib_none().0, region.to_glib_none().0, )) } } /// Begins a window move operation (for a toplevel window). /// /// This function assumes that the drag is controlled by the /// client pointer device, use [`begin_move_drag_for_device()`][Self::begin_move_drag_for_device()] /// to begin a drag with a different device. /// ## `button` /// the button being used to drag, or 0 for a keyboard-initiated drag /// ## `root_x` /// root window X coordinate of mouse click that began the drag /// ## `root_y` /// root window Y coordinate of mouse click that began the drag /// ## `timestamp` /// timestamp of mouse click that began the drag #[doc(alias = "gdk_window_begin_move_drag")] pub fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32) { unsafe { ffi::gdk_window_begin_move_drag( self.to_glib_none().0, button, root_x, root_y, timestamp, ); } } /// Begins a window move operation (for a toplevel window). /// You might use this function to implement a “window move grip,” for /// example. The function works best with window managers that support the /// [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) /// but has a fallback implementation for other window managers. /// ## `device` /// the device used for the operation /// ## `button` /// the button being used to drag, or 0 for a keyboard-initiated drag /// ## `root_x` /// root window X coordinate of mouse click that began the drag /// ## `root_y` /// root window Y coordinate of mouse click that began the drag /// ## `timestamp` /// timestamp of mouse click that began the drag #[doc(alias = "gdk_window_begin_move_drag_for_device")] pub fn begin_move_drag_for_device( &self, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, ) { unsafe { ffi::gdk_window_begin_move_drag_for_device( self.to_glib_none().0, device.to_glib_none().0, button, root_x, root_y, timestamp, ); } } /// A convenience wrapper around [`begin_paint_region()`][Self::begin_paint_region()] which /// creates a rectangular region for you. See /// [`begin_paint_region()`][Self::begin_paint_region()] for details. /// /// # Deprecated since 3.22 /// /// Use [`begin_draw_frame()`][Self::begin_draw_frame()] instead /// ## `rectangle` /// rectangle you intend to draw to #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] #[doc(alias = "gdk_window_begin_paint_rect")] pub fn begin_paint_rect(&self, rectangle: &Rectangle) { unsafe { ffi::gdk_window_begin_paint_rect(self.to_glib_none().0, rectangle.to_glib_none().0); } } /// Indicates that you are beginning the process of redrawing `region`. /// A backing store (offscreen buffer) large enough to contain `region` /// will be created. The backing store will be initialized with the /// background color or background surface for `self`. Then, all /// drawing operations performed on `self` will be diverted to the /// backing store. When you call [`end_paint()`][Self::end_paint()], the backing /// store will be copied to `self`, making it visible onscreen. Only /// the part of `self` contained in `region` will be modified; that is, /// drawing operations are clipped to `region`. /// /// The net result of all this is to remove flicker, because the user /// sees the finished product appear all at once when you call /// [`end_paint()`][Self::end_paint()]. If you draw to `self` directly without /// calling [`begin_paint_region()`][Self::begin_paint_region()], the user may see flicker /// as individual drawing operations are performed in sequence. The /// clipping and background-initializing features of /// [`begin_paint_region()`][Self::begin_paint_region()] are conveniences for the /// programmer, so you can avoid doing that work yourself. /// /// When using GTK+, the widget system automatically places calls to /// [`begin_paint_region()`][Self::begin_paint_region()] and [`end_paint()`][Self::end_paint()] around /// emissions of the expose_event signal. That is, if you’re writing an /// expose event handler, you can assume that the exposed area in /// [`EventExpose`][crate::EventExpose] has already been cleared to the window background, /// is already set as the clip region, and already has a backing store. /// Therefore in most cases, application code need not call /// [`begin_paint_region()`][Self::begin_paint_region()]. (You can disable the automatic /// calls around expose events on a widget-by-widget basis by calling /// `gtk_widget_set_double_buffered()`.) /// /// If you call this function multiple times before calling the /// matching [`end_paint()`][Self::end_paint()], the backing stores are pushed onto /// a stack. [`end_paint()`][Self::end_paint()] copies the topmost backing store /// onscreen, subtracts the topmost region from all other regions in /// the stack, and pops the stack. All drawing operations affect only /// the topmost backing store in the stack. One matching call to /// [`end_paint()`][Self::end_paint()] is required for each call to /// [`begin_paint_region()`][Self::begin_paint_region()]. /// /// # Deprecated since 3.22 /// /// Use [`begin_draw_frame()`][Self::begin_draw_frame()] instead /// ## `region` /// region you intend to draw to #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] #[doc(alias = "gdk_window_begin_paint_region")] pub fn begin_paint_region(&self, region: &cairo::Region) { unsafe { ffi::gdk_window_begin_paint_region(self.to_glib_none().0, region.to_glib_none().0); } } /// Begins a window resize operation (for a toplevel window). /// /// This function assumes that the drag is controlled by the /// client pointer device, use [`begin_resize_drag_for_device()`][Self::begin_resize_drag_for_device()] /// to begin a drag with a different device. /// ## `edge` /// the edge or corner from which the drag is started /// ## `button` /// the button being used to drag, or 0 for a keyboard-initiated drag /// ## `root_x` /// root window X coordinate of mouse click that began the drag /// ## `root_y` /// root window Y coordinate of mouse click that began the drag /// ## `timestamp` /// timestamp of mouse click that began the drag (use `gdk_event_get_time()`) #[doc(alias = "gdk_window_begin_resize_drag")] pub fn begin_resize_drag( &self, edge: WindowEdge, button: i32, root_x: i32, root_y: i32, timestamp: u32, ) { unsafe { ffi::gdk_window_begin_resize_drag( self.to_glib_none().0, edge.into_glib(), button, root_x, root_y, timestamp, ); } } /// Begins a window resize operation (for a toplevel window). /// You might use this function to implement a “window resize grip,” for /// example; in fact `GtkStatusbar` uses it. The function works best /// with window managers that support the /// [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) /// but has a fallback implementation for other window managers. /// ## `edge` /// the edge or corner from which the drag is started /// ## `device` /// the device used for the operation /// ## `button` /// the button being used to drag, or 0 for a keyboard-initiated drag /// ## `root_x` /// root window X coordinate of mouse click that began the drag /// ## `root_y` /// root window Y coordinate of mouse click that began the drag /// ## `timestamp` /// timestamp of mouse click that began the drag (use `gdk_event_get_time()`) #[doc(alias = "gdk_window_begin_resize_drag_for_device")] pub fn begin_resize_drag_for_device( &self, edge: WindowEdge, device: &Device, button: i32, root_x: i32, root_y: i32, timestamp: u32, ) { unsafe { ffi::gdk_window_begin_resize_drag_for_device( self.to_glib_none().0, edge.into_glib(), device.to_glib_none().0, button, root_x, root_y, timestamp, ); } } /// Transforms window coordinates from a parent window to a child /// window, where the parent window is the normal parent as returned by /// [`parent()`][Self::parent()] for normal windows, and the window's /// embedder as returned by `gdk_offscreen_window_get_embedder()` for /// offscreen windows. /// /// For normal windows, calling this function is equivalent to subtracting /// the return values of [`position()`][Self::position()] from the parent coordinates. /// For offscreen windows however (which can be arbitrarily transformed), /// this function calls the GdkWindow::from-embedder: signal to translate /// the coordinates. /// /// You should always use this function when writing generic code that /// walks down a window hierarchy. /// /// See also: [`coords_to_parent()`][Self::coords_to_parent()] /// ## `parent_x` /// X coordinate in parent’s coordinate system /// ## `parent_y` /// Y coordinate in parent’s coordinate system /// /// # Returns /// /// /// ## `x` /// return location for X coordinate in child’s coordinate system /// /// ## `y` /// return location for Y coordinate in child’s coordinate system #[doc(alias = "gdk_window_coords_from_parent")] pub fn coords_from_parent(&self, parent_x: f64, parent_y: f64) -> (f64, f64) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); ffi::gdk_window_coords_from_parent( self.to_glib_none().0, parent_x, parent_y, x.as_mut_ptr(), y.as_mut_ptr(), ); let x = x.assume_init(); let y = y.assume_init(); (x, y) } } /// Transforms window coordinates from a child window to its parent /// window, where the parent window is the normal parent as returned by /// [`parent()`][Self::parent()] for normal windows, and the window's /// embedder as returned by `gdk_offscreen_window_get_embedder()` for /// offscreen windows. /// /// For normal windows, calling this function is equivalent to adding /// the return values of [`position()`][Self::position()] to the child coordinates. /// For offscreen windows however (which can be arbitrarily transformed), /// this function calls the GdkWindow::to-embedder: signal to translate /// the coordinates. /// /// You should always use this function when writing generic code that /// walks up a window hierarchy. /// /// See also: [`coords_from_parent()`][Self::coords_from_parent()] /// ## `x` /// X coordinate in child’s coordinate system /// ## `y` /// Y coordinate in child’s coordinate system /// /// # Returns /// /// /// ## `parent_x` /// return location for X coordinate /// in parent’s coordinate system, or [`None`] /// /// ## `parent_y` /// return location for Y coordinate /// in parent’s coordinate system, or [`None`] #[doc(alias = "gdk_window_coords_to_parent")] pub fn coords_to_parent(&self, x: f64, y: f64) -> (f64, f64) { unsafe { let mut parent_x = mem::MaybeUninit::uninit(); let mut parent_y = mem::MaybeUninit::uninit(); ffi::gdk_window_coords_to_parent( self.to_glib_none().0, x, y, parent_x.as_mut_ptr(), parent_y.as_mut_ptr(), ); let parent_x = parent_x.assume_init(); let parent_y = parent_y.assume_init(); (parent_x, parent_y) } } /// Creates a new [`GLContext`][crate::GLContext] matching the /// framebuffer format to the visual of the [`Window`][crate::Window]. The context /// is disconnected from any particular window or surface. /// /// If the creation of the [`GLContext`][crate::GLContext] failed, `error` will be set. /// /// Before using the returned [`GLContext`][crate::GLContext], you will need to /// call [`GLContext::make_current()`][crate::GLContext::make_current()] or [`GLContext::realize()`][crate::GLContext::realize()]. /// /// # Returns /// /// the newly created [`GLContext`][crate::GLContext], or /// [`None`] on error #[doc(alias = "gdk_window_create_gl_context")] pub fn create_gl_context(&self) -> Result<GLContext, glib::Error> { unsafe { let mut error = ptr::null_mut(); let ret = ffi::gdk_window_create_gl_context(self.to_glib_none().0, &mut error); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } /// Attempt to deiconify (unminimize) `self`. On X11 the window manager may /// choose to ignore the request to deiconify. When using GTK+, /// use `gtk_window_deiconify()` instead of the [`Window`][crate::Window] variant. Or better yet, /// you probably want to use `gtk_window_present_with_time()`, which raises the window, focuses it, /// unminimizes it, and puts it on the current desktop. #[doc(alias = "gdk_window_deiconify")] pub fn deiconify(&self) { unsafe { ffi::gdk_window_deiconify(self.to_glib_none().0); } } /// Destroys the window system resources associated with `self` and decrements `self`'s /// reference count. The window system resources for all children of `self` are also /// destroyed, but the children’s reference counts are not decremented. /// /// Note that a window will not be destroyed automatically when its reference count /// reaches zero. You must call this function yourself before that happens. #[doc(alias = "gdk_window_destroy")] pub fn destroy(&self) { unsafe { ffi::gdk_window_destroy(self.to_glib_none().0); } } #[doc(alias = "gdk_window_destroy_notify")] pub fn destroy_notify(&self) { unsafe { ffi::gdk_window_destroy_notify(self.to_glib_none().0); } } /// Indicates that the drawing of the contents of `self` started with /// `gdk_window_begin_frame()` has been completed. /// /// This function will take care of destroying the [`DrawingContext`][crate::DrawingContext]. /// /// It is an error to call this function without a matching /// `gdk_window_begin_frame()` first. /// ## `context` /// the [`DrawingContext`][crate::DrawingContext] created by [`begin_draw_frame()`][Self::begin_draw_frame()] #[cfg(any(feature = "v3_22", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] #[doc(alias = "gdk_window_end_draw_frame")] pub fn end_draw_frame(&self, context: &DrawingContext) { unsafe { ffi::gdk_window_end_draw_frame(self.to_glib_none().0, context.to_glib_none().0); } } /// Indicates that the backing store created by the most recent call /// to [`begin_paint_region()`][Self::begin_paint_region()] should be copied onscreen and /// deleted, leaving the next-most-recent backing store or no backing /// store at all as the active paint region. See /// [`begin_paint_region()`][Self::begin_paint_region()] for full details. /// /// It is an error to call this function without a matching /// [`begin_paint_region()`][Self::begin_paint_region()] first. #[doc(alias = "gdk_window_end_paint")] pub fn end_paint(&self) { unsafe { ffi::gdk_window_end_paint(self.to_glib_none().0); } } /// Tries to ensure that there is a window-system native window for this /// GdkWindow. This may fail in some situations, returning [`false`]. /// /// Offscreen window and children of them can never have native windows. /// /// Some backends may not support native child windows. /// /// # Returns /// /// [`true`] if the window has a native window, [`false`] otherwise #[doc(alias = "gdk_window_ensure_native")] pub fn ensure_native(&self) -> bool { unsafe { from_glib(ffi::gdk_window_ensure_native(self.to_glib_none().0)) } } /// Sets keyboard focus to `self`. In most cases, `gtk_window_present_with_time()` /// should be used on a `GtkWindow`, rather than calling this function. /// ## `timestamp` /// timestamp of the event triggering the window focus #[doc(alias = "gdk_window_focus")] pub fn focus(&self, timestamp: u32) { unsafe { ffi::gdk_window_focus(self.to_glib_none().0, timestamp); } } /// Temporarily freezes a window such that it won’t receive expose /// events. The window will begin receiving expose events again when /// [`thaw_updates()`][Self::thaw_updates()] is called. If [`freeze_updates()`][Self::freeze_updates()] /// has been called more than once, [`thaw_updates()`][Self::thaw_updates()] must be called /// an equal number of times to begin processing exposes. #[doc(alias = "gdk_window_freeze_updates")] pub fn freeze_updates(&self) { unsafe { ffi::gdk_window_freeze_updates(self.to_glib_none().0); } } /// Moves the window into fullscreen mode. This means the /// window covers the entire screen and is above any panels /// or task bars. /// /// If the window was already fullscreen, then this function does nothing. /// /// On X11, asks the window manager to put `self` in a fullscreen /// state, if the window manager supports this operation. Not all /// window managers support this, and some deliberately ignore it or /// don’t have a concept of “fullscreen”; so you can’t rely on the /// fullscreenification actually happening. But it will happen with /// most standard window managers, and GDK makes a best effort to get /// it to happen. #[doc(alias = "gdk_window_fullscreen")] pub fn fullscreen(&self) { unsafe { ffi::gdk_window_fullscreen(self.to_glib_none().0); } } /// Moves the window into fullscreen mode on the given monitor. This means /// the window covers the entire screen and is above any panels or task bars. /// /// If the window was already fullscreen, then this function does nothing. /// ## `monitor` /// Which monitor to display fullscreen on. #[doc(alias = "gdk_window_fullscreen_on_monitor")] pub fn fullscreen_on_monitor(&self, monitor: i32) { unsafe { ffi::gdk_window_fullscreen_on_monitor(self.to_glib_none().0, monitor); } } /// This function informs GDK that the geometry of an embedded /// offscreen window has changed. This is necessary for GDK to keep /// track of which offscreen window the pointer is in. #[doc(alias = "gdk_window_geometry_changed")] pub fn geometry_changed(&self) { unsafe { ffi::gdk_window_geometry_changed(self.to_glib_none().0); } } /// Determines whether or not the desktop environment shuld be hinted that /// the window does not want to receive input focus. /// /// # Returns /// /// whether or not the window should receive input focus. #[doc(alias = "gdk_window_get_accept_focus")] #[doc(alias = "get_accept_focus")] pub fn accepts_focus(&self) -> bool { unsafe { from_glib(ffi::gdk_window_get_accept_focus(self.to_glib_none().0)) } } /// Gets the list of children of `self` known to GDK. /// This function only returns children created via GDK, /// so for example it’s useless when used with the root window; /// it only returns windows an application created itself. /// /// The returned list must be freed, but the elements in the /// list need not be. /// /// # Returns /// /// /// list of child windows inside `self` #[doc(alias = "gdk_window_get_children")] #[doc(alias = "get_children")] pub fn children(&self) -> Vec<Window> { unsafe { FromGlibPtrContainer::from_glib_container(ffi::gdk_window_get_children( self.to_glib_none().0, )) } } //#[doc(alias = "gdk_window_get_children_with_user_data")] //#[doc(alias = "get_children_with_user_data")] //pub fn children_with_user_data(&self, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Vec<Window> { // unsafe { TODO: call ffi:gdk_window_get_children_with_user_data() } //} /// Computes the region of a window that potentially can be written /// to by drawing primitives. This region may not take into account /// other factors such as if the window is obscured by other windows, /// but no area outside of this region will be affected by drawing /// primitives. /// /// # Returns /// /// a [`cairo::Region`][crate::cairo::Region]. This must be freed with `cairo_region_destroy()` /// when you are done. #[doc(alias = "gdk_window_get_clip_region")] #[doc(alias = "get_clip_region")] pub fn clip_region(&self) -> Option<cairo::Region> { unsafe { from_glib_full(ffi::gdk_window_get_clip_region(self.to_glib_none().0)) } } /// Retrieves a [`Cursor`][crate::Cursor] pointer for the cursor currently set on the /// specified [`Window`][crate::Window], or [`None`]. If the return value is [`None`] then /// there is no custom cursor set on the specified window, and it is /// using the cursor for its parent window. /// /// # Returns /// /// a [`Cursor`][crate::Cursor], or [`None`]. The /// returned object is owned by the [`Window`][crate::Window] and should not be /// unreferenced directly. Use [`set_cursor()`][Self::set_cursor()] to unset the /// cursor of the window #[doc(alias = "gdk_window_get_cursor")] #[doc(alias = "get_cursor")] pub fn cursor(&self) -> Option<Cursor> { unsafe { from_glib_none(ffi::gdk_window_get_cursor(self.to_glib_none().0)) } } /// Returns the decorations set on the GdkWindow with /// [`set_decorations()`][Self::set_decorations()]. /// /// # Returns /// /// [`true`] if the window has decorations set, [`false`] otherwise. /// /// ## `decorations` /// The window decorations will be written here #[doc(alias = "gdk_window_get_decorations")] #[doc(alias = "get_decorations")] pub fn decorations(&self) -> Option<WMDecoration> { unsafe { let mut decorations = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gdk_window_get_decorations( self.to_glib_none().0, decorations.as_mut_ptr(), )); let decorations = decorations.assume_init(); if ret { Some(from_glib(decorations)) } else { None } } } /// Retrieves a [`Cursor`][crate::Cursor] pointer for the `device` currently set on the /// specified [`Window`][crate::Window], or [`None`]. If the return value is [`None`] then /// there is no custom cursor set on the specified window, and it is /// using the cursor for its parent window. /// ## `device` /// a master, pointer [`Device`][crate::Device]. /// /// # Returns /// /// a [`Cursor`][crate::Cursor], or [`None`]. The /// returned object is owned by the [`Window`][crate::Window] and should not be /// unreferenced directly. Use [`set_cursor()`][Self::set_cursor()] to unset the /// cursor of the window #[doc(alias = "gdk_window_get_device_cursor")] #[doc(alias = "get_device_cursor")] pub fn device_cursor(&self, device: &Device) -> Option<Cursor> { unsafe { from_glib_none(ffi::gdk_window_get_device_cursor( self.to_glib_none().0, device.to_glib_none().0, )) } } /// Returns the event mask for `self` corresponding to an specific device. /// ## `device` /// a [`Device`][crate::Device]. /// /// # Returns /// /// device event mask for `self` #[doc(alias = "gdk_window_get_device_events")] #[doc(alias = "get_device_events")] pub fn device_events(&self, device: &Device) -> EventMask { unsafe { from_glib(ffi::gdk_window_get_device_events( self.to_glib_none().0, device.to_glib_none().0, )) } } /// Obtains the current device position and modifier state. /// The position is given in coordinates relative to the upper left /// corner of `self`. /// /// Use [`device_position_double()`][Self::device_position_double()] if you need subpixel precision. /// ## `device` /// pointer [`Device`][crate::Device] to query to. /// /// # Returns /// /// The window underneath `device` /// (as with [`Device::window_at_position()`][crate::Device::window_at_position()]), or [`None`] if the /// window is not known to GDK. /// /// ## `x` /// return location for the X coordinate of `device`, or [`None`]. /// /// ## `y` /// return location for the Y coordinate of `device`, or [`None`]. /// /// ## `mask` /// return location for the modifier mask, or [`None`]. #[doc(alias = "gdk_window_get_device_position")] #[doc(alias = "get_device_position")] pub fn device_position(&self, device: &Device) -> (Option<Window>, i32, i32, ModifierType) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); let mut mask = mem::MaybeUninit::uninit(); let ret = from_glib_none(ffi::gdk_window_get_device_position( self.to_glib_none().0, device.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr(), mask.as_mut_ptr(), )); let x = x.assume_init(); let y = y.assume_init(); let mask = mask.assume_init(); (ret, x, y, from_glib(mask)) } } /// Obtains the current device position in doubles and modifier state. /// The position is given in coordinates relative to the upper left /// corner of `self`. /// ## `device` /// pointer [`Device`][crate::Device] to query to. /// /// # Returns /// /// The window underneath `device` /// (as with [`Device::window_at_position()`][crate::Device::window_at_position()]), or [`None`] if the /// window is not known to GDK. /// /// ## `x` /// return location for the X coordinate of `device`, or [`None`]. /// /// ## `y` /// return location for the Y coordinate of `device`, or [`None`]. /// /// ## `mask` /// return location for the modifier mask, or [`None`]. #[doc(alias = "gdk_window_get_device_position_double")] #[doc(alias = "get_device_position_double")] pub fn device_position_double( &self, device: &Device, ) -> (Option<Window>, f64, f64, ModifierType) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); let mut mask = mem::MaybeUninit::uninit(); let ret = from_glib_none(ffi::gdk_window_get_device_position_double( self.to_glib_none().0, device.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr(), mask.as_mut_ptr(), )); let x = x.assume_init(); let y = y.assume_init(); let mask = mask.assume_init(); (ret, x, y, from_glib(mask)) } } /// Gets the [`Display`][crate::Display] associated with a [`Window`][crate::Window]. /// /// # Returns /// /// the [`Display`][crate::Display] associated with `self` #[doc(alias = "gdk_window_get_display")] #[doc(alias = "get_display")] pub fn display(&self) -> Display { unsafe { from_glib_none(ffi::gdk_window_get_display(self.to_glib_none().0)) } } /// Finds out the DND protocol supported by a window. /// /// # Returns /// /// the supported DND protocol. /// /// ## `target` /// location of the window /// where the drop should happen. This may be `self` or a proxy window, /// or [`None`] if `self` does not support Drag and Drop. #[doc(alias = "gdk_window_get_drag_protocol")] #[doc(alias = "get_drag_protocol")] pub fn drag_protocol(&self) -> (DragProtocol, Window) { unsafe { let mut target = ptr::null_mut(); let ret = from_glib(ffi::gdk_window_get_drag_protocol( self.to_glib_none().0, &mut target, )); (ret, from_glib_full(target)) } } /// Obtains the parent of `self`, as known to GDK. Works like /// [`parent()`][Self::parent()] for normal windows, but returns the /// window’s embedder for offscreen windows. /// /// See also: `gdk_offscreen_window_get_embedder()` /// /// # Returns /// /// effective parent of `self` #[doc(alias = "gdk_window_get_effective_parent")] #[doc(alias = "get_effective_parent")] pub fn effective_parent(&self) -> Option<Window> { unsafe { from_glib_none(ffi::gdk_window_get_effective_parent(self.to_glib_none().0)) } } /// Gets the toplevel window that’s an ancestor of `self`. /// /// Works like [`toplevel()`][Self::toplevel()], but treats an offscreen window's /// embedder as its parent, using [`effective_parent()`][Self::effective_parent()]. /// /// See also: `gdk_offscreen_window_get_embedder()` /// /// # Returns /// /// the effective toplevel window containing `self` #[doc(alias = "gdk_window_get_effective_toplevel")] #[doc(alias = "get_effective_toplevel")] pub fn effective_toplevel(&self) -> Window { unsafe { from_glib_none(ffi::gdk_window_get_effective_toplevel( self.to_glib_none().0, )) } } /// Get the current event compression setting for this window. /// /// # Returns /// /// [`true`] if motion events will be compressed #[doc(alias = "gdk_window_get_event_compression")] #[doc(alias = "get_event_compression")] pub fn does_event_compression(&self) -> bool { unsafe { from_glib(ffi::gdk_window_get_event_compression(self.to_glib_none().0)) } } /// Gets the event mask for `self` for all master input devices. See /// [`set_events()`][Self::set_events()]. /// /// # Returns /// /// event mask for `self` #[doc(alias = "gdk_window_get_events")] #[doc(alias = "get_events")] pub fn events(&self) -> EventMask { unsafe { from_glib(ffi::gdk_window_get_events(self.to_glib_none().0)) } } /// Determines whether or not the desktop environment should be hinted that the /// window does not want to receive input focus when it is mapped. /// /// # Returns /// /// whether or not the window wants to receive input focus when /// it is mapped. #[doc(alias = "gdk_window_get_focus_on_map")] #[doc(alias = "get_focus_on_map")] pub fn gets_focus_on_map(&self) -> bool { unsafe { from_glib(ffi::gdk_window_get_focus_on_map(self.to_glib_none().0)) } } /// Gets the frame clock for the window. The frame clock for a window /// never changes unless the window is reparented to a new toplevel /// window. /// /// # Returns /// /// the frame clock #[doc(alias = "gdk_window_get_frame_clock")] #[doc(alias = "get_frame_clock")] pub fn frame_clock(&self) -> Option<FrameClock> { unsafe { from_glib_none(ffi::gdk_window_get_frame_clock(self.to_glib_none().0)) } } /// Obtains the bounding box of the window, including window manager /// titlebar/borders if any. The frame position is given in root window /// coordinates. To get the position of the window itself (rather than /// the frame) in root window coordinates, use [`origin()`][Self::origin()]. /// /// # Returns /// /// /// ## `rect` /// rectangle to fill with bounding box of the window frame #[doc(alias = "gdk_window_get_frame_extents")] #[doc(alias = "get_frame_extents")] pub fn frame_extents(&self) -> Rectangle { unsafe { let mut rect = Rectangle::uninitialized(); ffi::gdk_window_get_frame_extents(self.to_glib_none().0, rect.to_glib_none_mut().0); rect } } /// Obtains the [`FullscreenMode`][crate::FullscreenMode] of the `self`. /// /// # Returns /// /// The [`FullscreenMode`][crate::FullscreenMode] applied to the window when fullscreen. #[doc(alias = "gdk_window_get_fullscreen_mode")] #[doc(alias = "get_fullscreen_mode")] pub fn fullscreen_mode(&self) -> FullscreenMode { unsafe { from_glib(ffi::gdk_window_get_fullscreen_mode(self.to_glib_none().0)) } } /// Any of the return location arguments to this function may be [`None`], /// if you aren’t interested in getting the value of that field. /// /// The X and Y coordinates returned are relative to the parent window /// of `self`, which for toplevels usually means relative to the /// window decorations (titlebar, etc.) rather than relative to the /// root window (screen-size background window). /// /// On the X11 platform, the geometry is obtained from the X server, /// so reflects the latest position of `self`; this may be out-of-sync /// with the position of `self` delivered in the most-recently-processed /// [`EventConfigure`][crate::EventConfigure]. [`position()`][Self::position()] in contrast gets the /// position from the most recent configure event. /// /// Note: If `self` is not a toplevel, it is much better /// to call [`position()`][Self::position()], [`width()`][Self::width()] and /// [`height()`][Self::height()] instead, because it avoids the roundtrip to /// the X server and because these functions support the full 32-bit /// coordinate space, whereas [`geometry()`][Self::geometry()] is restricted to /// the 16-bit coordinates of X11. /// /// # Returns /// /// /// ## `x` /// return location for X coordinate of window (relative to its parent) /// /// ## `y` /// return location for Y coordinate of window (relative to its parent) /// /// ## `width` /// return location for width of window /// /// ## `height` /// return location for height of window #[doc(alias = "gdk_window_get_geometry")] #[doc(alias = "get_geometry")] pub fn geometry(&self) -> (i32, i32, i32, i32) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); let mut width = mem::MaybeUninit::uninit(); let mut height = mem::MaybeUninit::uninit(); ffi::gdk_window_get_geometry( self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr(), width.as_mut_ptr(), height.as_mut_ptr(), ); let x = x.assume_init(); let y = y.assume_init(); let width = width.assume_init(); let height = height.assume_init(); (x, y, width, height) } } /// Returns the group leader window for `self`. See [`set_group()`][Self::set_group()]. /// /// # Returns /// /// the group leader window for `self` #[doc(alias = "gdk_window_get_group")] #[doc(alias = "get_group")] pub fn group(&self) -> Option<Window> { unsafe { from_glib_none(ffi::gdk_window_get_group(self.to_glib_none().0)) } } /// Returns the height of the given `self`. /// /// On the X11 platform the returned size is the size reported in the /// most-recently-processed configure event, rather than the current /// size on the X server. /// /// # Returns /// /// The height of `self` #[doc(alias = "gdk_window_get_height")] #[doc(alias = "get_height")] pub fn height(&self) -> i32 { unsafe { ffi::gdk_window_get_height(self.to_glib_none().0) } } /// Determines whether or not the window manager is hinted that `self` /// has modal behaviour. /// /// # Returns /// /// whether or not the window has the modal hint set. #[doc(alias = "gdk_window_get_modal_hint")] #[doc(alias = "get_modal_hint")] pub fn is_modal_hint(&self) -> bool { unsafe { from_glib(ffi::gdk_window_get_modal_hint(self.to_glib_none().0)) } } /// Obtains the position of a window in root window coordinates. /// (Compare with [`position()`][Self::position()] and /// [`geometry()`][Self::geometry()] which return the position of a window /// relative to its parent window.) /// /// # Returns /// /// not meaningful, ignore /// /// ## `x` /// return location for X coordinate /// /// ## `y` /// return location for Y coordinate #[doc(alias = "gdk_window_get_origin")] #[doc(alias = "get_origin")] pub fn origin(&self) -> (i32, i32, i32) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); let ret = ffi::gdk_window_get_origin(self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr()); let x = x.assume_init(); let y = y.assume_init(); (ret, x, y) } } /// Obtains the parent of `self`, as known to GDK. Does not query the /// X server; thus this returns the parent as passed to [`new()`][Self::new()], /// not the actual parent. This should never matter unless you’re using /// Xlib calls mixed with GDK calls on the X11 platform. It may also /// matter for toplevel windows, because the window manager may choose /// to reparent them. /// /// Note that you should use [`effective_parent()`][Self::effective_parent()] when /// writing generic code that walks up a window hierarchy, because /// [`parent()`][Self::parent()] will most likely not do what you expect if /// there are offscreen windows in the hierarchy. /// /// # Returns /// /// parent of `self` #[doc(alias = "gdk_window_get_parent")] #[doc(alias = "get_parent")] pub fn parent(&self) -> Option<Window> { unsafe { from_glib_none(ffi::gdk_window_get_parent(self.to_glib_none().0)) } } /// Returns whether input to the window is passed through to the window /// below. /// /// See [`set_pass_through()`][Self::set_pass_through()] for details #[doc(alias = "gdk_window_get_pass_through")] #[doc(alias = "get_pass_through")] pub fn is_pass_through(&self) -> bool { unsafe { from_glib(ffi::gdk_window_get_pass_through(self.to_glib_none().0)) } } /// Obtains the position of the window as reported in the /// most-recently-processed [`EventConfigure`][crate::EventConfigure]. Contrast with /// [`geometry()`][Self::geometry()] which queries the X server for the /// current window position, regardless of which events have been /// received or processed. /// /// The position coordinates are relative to the window’s parent window. /// /// # Returns /// /// /// ## `x` /// X coordinate of window /// /// ## `y` /// Y coordinate of window #[doc(alias = "gdk_window_get_position")] #[doc(alias = "get_position")] pub fn position(&self) -> (i32, i32) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); ffi::gdk_window_get_position(self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr()); let x = x.assume_init(); let y = y.assume_init(); (x, y) } } /// Obtains the position of a window position in root /// window coordinates. This is similar to /// [`origin()`][Self::origin()] but allows you to pass /// in any position in the window, not just the origin. /// ## `x` /// X coordinate in window /// ## `y` /// Y coordinate in window /// /// # Returns /// /// /// ## `root_x` /// return location for X coordinate /// /// ## `root_y` /// return location for Y coordinate #[doc(alias = "gdk_window_get_root_coords")] #[doc(alias = "get_root_coords")] pub fn root_coords(&self, x: i32, y: i32) -> (i32, i32) { unsafe { let mut root_x = mem::MaybeUninit::uninit(); let mut root_y = mem::MaybeUninit::uninit(); ffi::gdk_window_get_root_coords( self.to_glib_none().0, x, y, root_x.as_mut_ptr(), root_y.as_mut_ptr(), ); let root_x = root_x.assume_init(); let root_y = root_y.assume_init(); (root_x, root_y) } } /// Obtains the top-left corner of the window manager frame in root /// window coordinates. /// /// # Returns /// /// /// ## `x` /// return location for X position of window frame /// /// ## `y` /// return location for Y position of window frame #[doc(alias = "gdk_window_get_root_origin")] #[doc(alias = "get_root_origin")] pub fn root_origin(&self) -> (i32, i32) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); ffi::gdk_window_get_root_origin(self.to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr()); let x = x.assume_init(); let y = y.assume_init(); (x, y) } } /// Returns the internal scale factor that maps from window coordiantes /// to the actual device pixels. On traditional systems this is 1, but /// on very high density outputs this can be a higher value (often 2). /// /// A higher value means that drawing is automatically scaled up to /// a higher resolution, so any code doing drawing will automatically look /// nicer. However, if you are supplying pixel-based data the scale /// value can be used to determine whether to use a pixel resource /// with higher resolution data. /// /// The scale of a window may change during runtime, if this happens /// a configure event will be sent to the toplevel window. /// /// # Returns /// /// the scale factor #[doc(alias = "gdk_window_get_scale_factor")] #[doc(alias = "get_scale_factor")] pub fn scale_factor(&self) -> i32 { unsafe { ffi::gdk_window_get_scale_factor(self.to_glib_none().0) } } /// Gets the [`Screen`][crate::Screen] associated with a [`Window`][crate::Window]. /// /// # Returns /// /// the [`Screen`][crate::Screen] associated with `self` #[doc(alias = "gdk_window_get_screen")] #[doc(alias = "get_screen")] pub fn screen(&self) -> Screen { unsafe { from_glib_none(ffi::gdk_window_get_screen(self.to_glib_none().0)) } } /// Returns the event mask for `self` corresponding to the device class specified /// by `source`. /// ## `source` /// a [`InputSource`][crate::InputSource] to define the source class. /// /// # Returns /// /// source event mask for `self` #[doc(alias = "gdk_window_get_source_events")] #[doc(alias = "get_source_events")] pub fn source_events(&self, source: InputSource) -> EventMask { unsafe { from_glib(ffi::gdk_window_get_source_events( self.to_glib_none().0, source.into_glib(), )) } } /// Gets the bitwise OR of the currently active window state flags, /// from the [`WindowState`][crate::WindowState] enumeration. /// /// # Returns /// /// window state bitfield #[doc(alias = "gdk_window_get_state")] #[doc(alias = "get_state")] pub fn state(&self) -> WindowState { unsafe { from_glib(ffi::gdk_window_get_state(self.to_glib_none().0)) } } /// Returns [`true`] if the window is aware of the existence of multiple /// devices. /// /// # Returns /// /// [`true`] if the window handles multidevice features. #[doc(alias = "gdk_window_get_support_multidevice")] #[doc(alias = "get_support_multidevice")] pub fn supports_multidevice(&self) -> bool { unsafe { from_glib(ffi::gdk_window_get_support_multidevice( self.to_glib_none().0, )) } } /// Gets the toplevel window that’s an ancestor of `self`. /// /// Any window type but [`WindowType::Child`][crate::WindowType::Child] is considered a /// toplevel window, as is a [`WindowType::Child`][crate::WindowType::Child] window that /// has a root window as parent. /// /// Note that you should use [`effective_toplevel()`][Self::effective_toplevel()] when /// you want to get to a window’s toplevel as seen on screen, because /// [`toplevel()`][Self::toplevel()] will most likely not do what you expect /// if there are offscreen windows in the hierarchy. /// /// # Returns /// /// the toplevel window containing `self` #[doc(alias = "gdk_window_get_toplevel")] #[doc(alias = "get_toplevel")] pub fn toplevel(&self) -> Window { unsafe { from_glib_none(ffi::gdk_window_get_toplevel(self.to_glib_none().0)) } } /// This function returns the type hint set for a window. /// /// # Returns /// /// The type hint set for `self` #[doc(alias = "gdk_window_get_type_hint")] #[doc(alias = "get_type_hint")] pub fn type_hint(&self) -> WindowTypeHint { unsafe { from_glib(ffi::gdk_window_get_type_hint(self.to_glib_none().0)) } } /// Transfers ownership of the update area from `self` to the caller /// of the function. That is, after calling this function, `self` will /// no longer have an invalid/dirty region; the update area is removed /// from `self` and handed to you. If a window has no update area, /// [`update_area()`][Self::update_area()] returns [`None`]. You are responsible for /// calling `cairo_region_destroy()` on the returned region if it’s non-[`None`]. /// /// # Returns /// /// the update area for `self` #[doc(alias = "gdk_window_get_update_area")] #[doc(alias = "get_update_area")] pub fn update_area(&self) -> Option<cairo::Region> { unsafe { from_glib_full(ffi::gdk_window_get_update_area(self.to_glib_none().0)) } } /// Computes the region of the `self` that is potentially visible. /// This does not necessarily take into account if the window is /// obscured by other windows, but no area outside of this region /// is visible. /// /// # Returns /// /// a [`cairo::Region`][crate::cairo::Region]. This must be freed with `cairo_region_destroy()` /// when you are done. #[doc(alias = "gdk_window_get_visible_region")] #[doc(alias = "get_visible_region")] pub fn visible_region(&self) -> Option<cairo::Region> { unsafe { from_glib_full(ffi::gdk_window_get_visible_region(self.to_glib_none().0)) } } /// Gets the [`Visual`][crate::Visual] describing the pixel format of `self`. /// /// # Returns /// /// a [`Visual`][crate::Visual] #[doc(alias = "gdk_window_get_visual")] #[doc(alias = "get_visual")] pub fn visual(&self) -> Visual { unsafe { from_glib_none(ffi::gdk_window_get_visual(self.to_glib_none().0)) } } /// Returns the width of the given `self`. /// /// On the X11 platform the returned size is the size reported in the /// most-recently-processed configure event, rather than the current /// size on the X server. /// /// # Returns /// /// The width of `self` #[doc(alias = "gdk_window_get_width")] #[doc(alias = "get_width")] pub fn width(&self) -> i32 { unsafe { ffi::gdk_window_get_width(self.to_glib_none().0) } } /// Gets the type of the window. See [`WindowType`][crate::WindowType]. /// /// # Returns /// /// type of window #[doc(alias = "gdk_window_get_window_type")] #[doc(alias = "get_window_type")] pub fn window_type(&self) -> WindowType { unsafe { from_glib(ffi::gdk_window_get_window_type(self.to_glib_none().0)) } } /// Checks whether the window has a native window or not. Note that /// you can use [`ensure_native()`][Self::ensure_native()] if a native window is needed. /// /// # Returns /// /// [`true`] if the `self` has a native window, [`false`] otherwise. #[doc(alias = "gdk_window_has_native")] pub fn has_native(&self) -> bool { unsafe { from_glib(ffi::gdk_window_has_native(self.to_glib_none().0)) } } /// For toplevel windows, withdraws them, so they will no longer be /// known to the window manager; for all windows, unmaps them, so /// they won’t be displayed. Normally done automatically as /// part of `gtk_widget_hide()`. #[doc(alias = "gdk_window_hide")] pub fn hide(&self) { unsafe { ffi::gdk_window_hide(self.to_glib_none().0); } } /// Asks to iconify (minimize) `self`. The window manager may choose /// to ignore the request, but normally will honor it. Using /// `gtk_window_iconify()` is preferred, if you have a `GtkWindow` widget. /// /// This function only makes sense when `self` is a toplevel window. #[doc(alias = "gdk_window_iconify")] pub fn iconify(&self) { unsafe { ffi::gdk_window_iconify(self.to_glib_none().0); } } /// Like [`shape_combine_region()`][Self::shape_combine_region()], but the shape applies /// only to event handling. Mouse events which happen while /// the pointer position corresponds to an unset bit in the /// mask will be passed on the window below `self`. /// /// An input shape is typically used with RGBA windows. /// The alpha channel of the window defines which pixels are /// invisible and allows for nicely antialiased borders, /// and the input shape controls where the window is /// “clickable”. /// /// On the X11 platform, this requires version 1.1 of the /// shape extension. /// /// On the Win32 platform, this functionality is not present and the /// function does nothing. /// ## `shape_region` /// region of window to be non-transparent /// ## `offset_x` /// X position of `shape_region` in `self` coordinates /// ## `offset_y` /// Y position of `shape_region` in `self` coordinates #[doc(alias = "gdk_window_input_shape_combine_region")] pub fn input_shape_combine_region( &self, shape_region: &cairo::Region, offset_x: i32, offset_y: i32, ) { unsafe { ffi::gdk_window_input_shape_combine_region( self.to_glib_none().0, shape_region.to_glib_none().0, offset_x, offset_y, ); } } /// Adds `region` to the update area for `self`. The update area is the /// region that needs to be redrawn, or “dirty region.” The call /// [`process_updates()`][Self::process_updates()] sends one or more expose events to the /// window, which together cover the entire update area. An /// application would normally redraw the contents of `self` in /// response to those expose events. /// /// GDK will call [`process_all_updates()`][Self::process_all_updates()] on your behalf /// whenever your program returns to the main loop and becomes idle, so /// normally there’s no need to do that manually, you just need to /// invalidate regions that you know should be redrawn. /// /// The `child_func` parameter controls whether the region of /// each child window that intersects `region` will also be invalidated. /// Only children for which `child_func` returns [`true`] will have the area /// invalidated. /// ## `region` /// a [`cairo::Region`][crate::cairo::Region] /// ## `child_func` /// function to use to decide if to /// recurse to a child, [`None`] means never recurse. #[doc(alias = "gdk_window_invalidate_maybe_recurse")] pub fn invalidate_maybe_recurse( &self, region: &cairo::Region, child_func: Option<&mut dyn (FnMut(&Window) -> bool)>, ) { let child_func_data: Option<&mut dyn (FnMut(&Window) -> bool)> = child_func; unsafe extern "C" fn child_func_func( window: *mut ffi::GdkWindow, user_data: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let window = from_glib_borrow(window); let callback: *mut Option<&mut dyn (FnMut(&Window) -> bool)> = user_data as *const _ as usize as *mut Option<&mut dyn (FnMut(&Window) -> bool)>; let res = if let Some(ref mut callback) = *callback { callback(&window) } else { panic!("cannot get closure...") }; res.into_glib() } let child_func = if child_func_data.is_some() { Some(child_func_func as _) } else { None }; let super_callback0: &Option<&mut dyn (FnMut(&Window) -> bool)> = &child_func_data; unsafe { ffi::gdk_window_invalidate_maybe_recurse( self.to_glib_none().0, region.to_glib_none().0, child_func, super_callback0 as *const _ as usize as *mut _, ); } } /// A convenience wrapper around [`invalidate_region()`][Self::invalidate_region()] which /// invalidates a rectangular region. See /// [`invalidate_region()`][Self::invalidate_region()] for details. /// ## `rect` /// rectangle to invalidate or [`None`] to invalidate the whole /// window /// ## `invalidate_children` /// whether to also invalidate child windows #[doc(alias = "gdk_window_invalidate_rect")] pub fn invalidate_rect(&self, rect: Option<&Rectangle>, invalidate_children: bool) { unsafe { ffi::gdk_window_invalidate_rect( self.to_glib_none().0, rect.to_glib_none().0, invalidate_children.into_glib(), ); } } /// Adds `region` to the update area for `self`. The update area is the /// region that needs to be redrawn, or “dirty region.” The call /// [`process_updates()`][Self::process_updates()] sends one or more expose events to the /// window, which together cover the entire update area. An /// application would normally redraw the contents of `self` in /// response to those expose events. /// /// GDK will call [`process_all_updates()`][Self::process_all_updates()] on your behalf /// whenever your program returns to the main loop and becomes idle, so /// normally there’s no need to do that manually, you just need to /// invalidate regions that you know should be redrawn. /// /// The `invalidate_children` parameter controls whether the region of /// each child window that intersects `region` will also be invalidated. /// If [`false`], then the update area for child windows will remain /// unaffected. See gdk_window_invalidate_maybe_recurse if you need /// fine grained control over which children are invalidated. /// ## `region` /// a [`cairo::Region`][crate::cairo::Region] /// ## `invalidate_children` /// [`true`] to also invalidate child windows #[doc(alias = "gdk_window_invalidate_region")] pub fn invalidate_region(&self, region: &cairo::Region, invalidate_children: bool) { unsafe { ffi::gdk_window_invalidate_region( self.to_glib_none().0, region.to_glib_none().0, invalidate_children.into_glib(), ); } } /// Check to see if a window is destroyed.. /// /// # Returns /// /// [`true`] if the window is destroyed #[doc(alias = "gdk_window_is_destroyed")] pub fn is_destroyed(&self) -> bool { unsafe { from_glib(ffi::gdk_window_is_destroyed(self.to_glib_none().0)) } } /// Determines whether or not the window is an input only window. /// /// # Returns /// /// [`true`] if `self` is input only #[doc(alias = "gdk_window_is_input_only")] pub fn is_input_only(&self) -> bool { unsafe { from_glib(ffi::gdk_window_is_input_only(self.to_glib_none().0)) } } /// Determines whether or not the window is shaped. /// /// # Returns /// /// [`true`] if `self` is shaped #[doc(alias = "gdk_window_is_shaped")] pub fn is_shaped(&self) -> bool { unsafe { from_glib(ffi::gdk_window_is_shaped(self.to_glib_none().0)) } } /// Check if the window and all ancestors of the window are /// mapped. (This is not necessarily "viewable" in the X sense, since /// we only check as far as we have GDK window parents, not to the root /// window.) /// /// # Returns /// /// [`true`] if the window is viewable #[doc(alias = "gdk_window_is_viewable")] pub fn is_viewable(&self) -> bool { unsafe { from_glib(ffi::gdk_window_is_viewable(self.to_glib_none().0)) } } /// Checks whether the window has been mapped (with [`show()`][Self::show()] or /// [`show_unraised()`][Self::show_unraised()]). /// /// # Returns /// /// [`true`] if the window is mapped #[doc(alias = "gdk_window_is_visible")] pub fn is_visible(&self) -> bool { unsafe { from_glib(ffi::gdk_window_is_visible(self.to_glib_none().0)) } } /// Lowers `self` to the bottom of the Z-order (stacking order), so that /// other windows with the same parent window appear above `self`. /// This is true whether or not the other windows are visible. /// /// If `self` is a toplevel, the window manager may choose to deny the /// request to move the window in the Z-order, [`lower()`][Self::lower()] only /// requests the restack, does not guarantee it. /// /// Note that [`show()`][Self::show()] raises the window again, so don’t call this /// function before [`show()`][Self::show()]. (Try [`show_unraised()`][Self::show_unraised()].) #[doc(alias = "gdk_window_lower")] pub fn lower(&self) { unsafe { ffi::gdk_window_lower(self.to_glib_none().0); } } /// If you call this during a paint (e.g. between [`begin_paint_region()`][Self::begin_paint_region()] /// and [`end_paint()`][Self::end_paint()] then GDK will mark the current clip region of the /// window as being drawn. This is required when mixing GL rendering via /// `gdk_cairo_draw_from_gl()` and cairo rendering, as otherwise GDK has no way /// of knowing when something paints over the GL-drawn regions. /// /// This is typically called automatically by GTK+ and you don't need /// to care about this. /// ## `cr` /// a [`cairo::Context`][crate::cairo::Context] #[doc(alias = "gdk_window_mark_paint_from_clip")] pub fn mark_paint_from_clip(&self, cr: &cairo::Context) { unsafe { ffi::gdk_window_mark_paint_from_clip( self.to_glib_none().0, mut_override(cr.to_glib_none().0), ); } } /// Maximizes the window. If the window was already maximized, then /// this function does nothing. /// /// On X11, asks the window manager to maximize `self`, if the window /// manager supports this operation. Not all window managers support /// this, and some deliberately ignore it or don’t have a concept of /// “maximized”; so you can’t rely on the maximization actually /// happening. But it will happen with most standard window managers, /// and GDK makes a best effort to get it to happen. /// /// On Windows, reliably maximizes the window. #[doc(alias = "gdk_window_maximize")] pub fn maximize(&self) { unsafe { ffi::gdk_window_maximize(self.to_glib_none().0); } } /// Merges the input shape masks for any child windows into the /// input shape mask for `self`. i.e. the union of all input masks /// for `self` and its children will become the new input mask /// for `self`. See [`input_shape_combine_region()`][Self::input_shape_combine_region()]. /// /// This function is distinct from [`set_child_input_shapes()`][Self::set_child_input_shapes()] /// because it includes `self`’s input shape mask in the set of /// shapes to be merged. #[doc(alias = "gdk_window_merge_child_input_shapes")] pub fn merge_child_input_shapes(&self) { unsafe { ffi::gdk_window_merge_child_input_shapes(self.to_glib_none().0); } } /// Merges the shape masks for any child windows into the /// shape mask for `self`. i.e. the union of all masks /// for `self` and its children will become the new mask /// for `self`. See [`shape_combine_region()`][Self::shape_combine_region()]. /// /// This function is distinct from [`set_child_shapes()`][Self::set_child_shapes()] /// because it includes `self`’s shape mask in the set of shapes to /// be merged. #[doc(alias = "gdk_window_merge_child_shapes")] pub fn merge_child_shapes(&self) { unsafe { ffi::gdk_window_merge_child_shapes(self.to_glib_none().0); } } #[doc(alias = "gdk_window_move")] #[doc(alias = "move")] pub fn move_(&self, x: i32, y: i32) { unsafe { ffi::gdk_window_move(self.to_glib_none().0, x, y); } } /// Move the part of `self` indicated by `region` by `dy` pixels in the Y /// direction and `dx` pixels in the X direction. The portions of `region` /// that not covered by the new position of `region` are invalidated. /// /// Child windows are not moved. /// ## `region` /// The [`cairo::Region`][crate::cairo::Region] to move /// ## `dx` /// Amount to move in the X direction /// ## `dy` /// Amount to move in the Y direction #[doc(alias = "gdk_window_move_region")] pub fn move_region(&self, region: &cairo::Region, dx: i32, dy: i32) { unsafe { ffi::gdk_window_move_region(self.to_glib_none().0, region.to_glib_none().0, dx, dy); } } /// Equivalent to calling [`move_()`][Self::move_()] and [`resize()`][Self::resize()], /// except that both operations are performed at once, avoiding strange /// visual effects. (i.e. the user may be able to see the window first /// move, then resize, if you don’t use [`move_resize()`][Self::move_resize()].) /// ## `x` /// new X position relative to window’s parent /// ## `y` /// new Y position relative to window’s parent /// ## `width` /// new width /// ## `height` /// new height #[doc(alias = "gdk_window_move_resize")] pub fn move_resize(&self, x: i32, y: i32, width: i32, height: i32) { unsafe { ffi::gdk_window_move_resize(self.to_glib_none().0, x, y, width, height); } } /// Moves `self` to `rect`, aligning their anchor points. /// /// `rect` is relative to the top-left corner of the window that `self` is /// transient for. `rect_anchor` and `window_anchor` determine anchor points on /// `rect` and `self` to pin together. `rect`'s anchor point can optionally be /// offset by `rect_anchor_dx` and `rect_anchor_dy`, which is equivalent to /// offsetting the position of `self`. /// /// `anchor_hints` determines how `self` will be moved if the anchor points cause /// it to move off-screen. For example, [`AnchorHints::FLIP_X`][crate::AnchorHints::FLIP_X] will replace /// [`Gravity::NorthWest`][crate::Gravity::NorthWest] with [`Gravity::NorthEast`][crate::Gravity::NorthEast] and vice versa if /// `self` extends beyond the left or right edges of the monitor. /// /// Connect to the `signal::Window::moved-to-rect` signal to find out how it was /// actually positioned. /// ## `rect` /// the destination [`Rectangle`][crate::Rectangle] to align `self` with /// ## `rect_anchor` /// the point on `rect` to align with `self`'s anchor point /// ## `window_anchor` /// the point on `self` to align with `rect`'s anchor point /// ## `anchor_hints` /// positioning hints to use when limited on space /// ## `rect_anchor_dx` /// horizontal offset to shift `self`, i.e. `rect`'s anchor /// point /// ## `rect_anchor_dy` /// vertical offset to shift `self`, i.e. `rect`'s anchor point #[cfg(any(feature = "v3_24", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] #[doc(alias = "gdk_window_move_to_rect")] pub fn move_to_rect( &self, rect: &Rectangle, rect_anchor: Gravity, window_anchor: Gravity, anchor_hints: AnchorHints, rect_anchor_dx: i32, rect_anchor_dy: i32, ) { unsafe { ffi::gdk_window_move_to_rect( self.to_glib_none().0, rect.to_glib_none().0, rect_anchor.into_glib(), window_anchor.into_glib(), anchor_hints.into_glib(), rect_anchor_dx, rect_anchor_dy, ); } } /// Like [`children()`][Self::children()], but does not copy the list of /// children, so the list does not need to be freed. /// /// # Returns /// /// /// a reference to the list of child windows in `self` #[doc(alias = "gdk_window_peek_children")] pub fn peek_children(&self) -> Vec<Window> { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gdk_window_peek_children( self.to_glib_none().0, )) } } /// Sends one or more expose events to `self`. The areas in each /// expose event will cover the entire update area for the window (see /// [`invalidate_region()`][Self::invalidate_region()] for details). Normally GDK calls /// [`process_all_updates()`][Self::process_all_updates()] on your behalf, so there’s no /// need to call this function unless you want to force expose events /// to be delivered immediately and synchronously (vs. the usual /// case, where GDK delivers them in an idle handler). Occasionally /// this is useful to produce nicer scrolling behavior, for example. /// /// # Deprecated since 3.22 /// /// ## `update_children` /// whether to also process updates for child windows #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] #[doc(alias = "gdk_window_process_updates")] pub fn process_updates(&self, update_children: bool) { unsafe { ffi::gdk_window_process_updates(self.to_glib_none().0, update_children.into_glib()); } } /// Raises `self` to the top of the Z-order (stacking order), so that /// other windows with the same parent window appear below `self`. /// This is true whether or not the windows are visible. /// /// If `self` is a toplevel, the window manager may choose to deny the /// request to move the window in the Z-order, [`raise()`][Self::raise()] only /// requests the restack, does not guarantee it. #[doc(alias = "gdk_window_raise")] pub fn raise(&self) { unsafe { ffi::gdk_window_raise(self.to_glib_none().0); } } /// Registers a window as a potential drop destination. #[doc(alias = "gdk_window_register_dnd")] pub fn register_dnd(&self) { unsafe { ffi::gdk_window_register_dnd(self.to_glib_none().0); } } //#[doc(alias = "gdk_window_remove_filter")] //pub fn remove_filter(&self, function: /*Unimplemented*/Fn(/*Unimplemented*/XEvent, &Event) -> /*Ignored*/FilterReturn, data: /*Unimplemented*/Option<Fundamental: Pointer>) { // unsafe { TODO: call ffi:gdk_window_remove_filter() } //} /// Reparents `self` into the given `new_parent`. The window being /// reparented will be unmapped as a side effect. /// ## `new_parent` /// new parent to move `self` into /// ## `x` /// X location inside the new parent /// ## `y` /// Y location inside the new parent #[doc(alias = "gdk_window_reparent")] pub fn reparent(&self, new_parent: &Window, x: i32, y: i32) { unsafe { ffi::gdk_window_reparent(self.to_glib_none().0, new_parent.to_glib_none().0, x, y); } } /// Resizes `self`; for toplevel windows, asks the window manager to resize /// the window. The window manager may not allow the resize. When using GTK+, /// use `gtk_window_resize()` instead of this low-level GDK function. /// /// Windows may not be resized below 1x1. /// /// If you’re also planning to move the window, use [`move_resize()`][Self::move_resize()] /// to both move and resize simultaneously, for a nicer visual effect. /// ## `width` /// new width of the window /// ## `height` /// new height of the window #[doc(alias = "gdk_window_resize")] pub fn resize(&self, width: i32, height: i32) { unsafe { ffi::gdk_window_resize(self.to_glib_none().0, width, height); } } /// Changes the position of `self` in the Z-order (stacking order), so that /// it is above `sibling` (if `above` is [`true`]) or below `sibling` (if `above` is /// [`false`]). /// /// If `sibling` is [`None`], then this either raises (if `above` is [`true`]) or /// lowers the window. /// /// If `self` is a toplevel, the window manager may choose to deny the /// request to move the window in the Z-order, [`restack()`][Self::restack()] only /// requests the restack, does not guarantee it. /// ## `sibling` /// a [`Window`][crate::Window] that is a sibling of `self`, or [`None`] /// ## `above` /// a boolean #[doc(alias = "gdk_window_restack")] pub fn restack(&self, sibling: Option<&Window>, above: bool) { unsafe { ffi::gdk_window_restack( self.to_glib_none().0, sibling.to_glib_none().0, above.into_glib(), ); } } /// Scroll the contents of `self`, both pixels and children, by the /// given amount. `self` itself does not move. Portions of the window /// that the scroll operation brings in from offscreen areas are /// invalidated. The invalidated region may be bigger than what would /// strictly be necessary. /// /// For X11, a minimum area will be invalidated if the window has no /// subwindows, or if the edges of the window’s parent do not extend /// beyond the edges of the window. In other cases, a multi-step process /// is used to scroll the window which may produce temporary visual /// artifacts and unnecessary invalidations. /// ## `dx` /// Amount to scroll in the X direction /// ## `dy` /// Amount to scroll in the Y direction #[doc(alias = "gdk_window_scroll")] pub fn scroll(&self, dx: i32, dy: i32) { unsafe { ffi::gdk_window_scroll(self.to_glib_none().0, dx, dy); } } /// Setting `accept_focus` to [`false`] hints the desktop environment that the /// window doesn’t want to receive input focus. /// /// On X, it is the responsibility of the window manager to interpret this /// hint. ICCCM-compliant window manager usually respect it. /// ## `accept_focus` /// [`true`] if the window should receive input focus #[doc(alias = "gdk_window_set_accept_focus")] pub fn set_accept_focus(&self, accept_focus: bool) { unsafe { ffi::gdk_window_set_accept_focus(self.to_glib_none().0, accept_focus.into_glib()); } } /// Sets the background color of `self`. /// /// See also [`set_background_pattern()`][Self::set_background_pattern()]. /// /// # Deprecated since 3.22 /// /// Don't use this function /// ## `rgba` /// a [`RGBA`][crate::RGBA] color #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] #[doc(alias = "gdk_window_set_background_rgba")] pub fn set_background_rgba(&self, rgba: &RGBA) { unsafe { ffi::gdk_window_set_background_rgba(self.to_glib_none().0, rgba.to_glib_none().0); } } /// Sets the input shape mask of `self` to the union of input shape masks /// for all children of `self`, ignoring the input shape mask of `self` /// itself. Contrast with [`merge_child_input_shapes()`][Self::merge_child_input_shapes()] which includes /// the input shape mask of `self` in the masks to be merged. #[doc(alias = "gdk_window_set_child_input_shapes")] pub fn set_child_input_shapes(&self) { unsafe { ffi::gdk_window_set_child_input_shapes(self.to_glib_none().0); } } /// Sets the shape mask of `self` to the union of shape masks /// for all children of `self`, ignoring the shape mask of `self` /// itself. Contrast with [`merge_child_shapes()`][Self::merge_child_shapes()] which includes /// the shape mask of `self` in the masks to be merged. #[doc(alias = "gdk_window_set_child_shapes")] pub fn set_child_shapes(&self) { unsafe { ffi::gdk_window_set_child_shapes(self.to_glib_none().0); } } /// Sets the default mouse pointer for a [`Window`][crate::Window]. /// /// Note that `cursor` must be for the same display as `self`. /// /// Use [`Cursor::for_display()`][crate::Cursor::for_display()] or [`Cursor::from_pixbuf()`][crate::Cursor::from_pixbuf()] to /// create the cursor. To make the cursor invisible, use [`CursorType::BlankCursor`][crate::CursorType::BlankCursor]. /// Passing [`None`] for the `cursor` argument to [`set_cursor()`][Self::set_cursor()] means /// that `self` will use the cursor of its parent window. Most windows /// should use this default. /// ## `cursor` /// a cursor #[doc(alias = "gdk_window_set_cursor")] pub fn set_cursor(&self, cursor: Option<&Cursor>) { unsafe { ffi::gdk_window_set_cursor(self.to_glib_none().0, cursor.to_glib_none().0); } } /// “Decorations” are the features the window manager adds to a toplevel [`Window`][crate::Window]. /// This function sets the traditional Motif window manager hints that tell the /// window manager which decorations you would like your window to have. /// Usually you should use `gtk_window_set_decorated()` on a `GtkWindow` instead of /// using the GDK function directly. /// /// The `decorations` argument is the logical OR of the fields in /// the [`WMDecoration`][crate::WMDecoration] enumeration. If [`WMDecoration::ALL`][crate::WMDecoration::ALL] is included in the /// mask, the other bits indicate which decorations should be turned off. /// If [`WMDecoration::ALL`][crate::WMDecoration::ALL] is not included, then the other bits indicate /// which decorations should be turned on. /// /// Most window managers honor a decorations hint of 0 to disable all decorations, /// but very few honor all possible combinations of bits. /// ## `decorations` /// decoration hint mask #[doc(alias = "gdk_window_set_decorations")] pub fn set_decorations(&self, decorations: WMDecoration) { unsafe { ffi::gdk_window_set_decorations(self.to_glib_none().0, decorations.into_glib()); } } /// Sets a specific [`Cursor`][crate::Cursor] for a given device when it gets inside `self`. /// Use [`Cursor::for_display()`][crate::Cursor::for_display()] or [`Cursor::from_pixbuf()`][crate::Cursor::from_pixbuf()] to create /// the cursor. To make the cursor invisible, use [`CursorType::BlankCursor`][crate::CursorType::BlankCursor]. Passing /// [`None`] for the `cursor` argument to [`set_cursor()`][Self::set_cursor()] means that /// `self` will use the cursor of its parent window. Most windows should /// use this default. /// ## `device` /// a master, pointer [`Device`][crate::Device] /// ## `cursor` /// a [`Cursor`][crate::Cursor] #[doc(alias = "gdk_window_set_device_cursor")] pub fn set_device_cursor(&self, device: &Device, cursor: &Cursor) { unsafe { ffi::gdk_window_set_device_cursor( self.to_glib_none().0, device.to_glib_none().0, cursor.to_glib_none().0, ); } } /// Sets the event mask for a given device (Normally a floating device, not /// attached to any visible pointer) to `self`. For example, an event mask /// including [`EventMask::BUTTON_PRESS_MASK`][crate::EventMask::BUTTON_PRESS_MASK] means the window should report button /// press events. The event mask is the bitwise OR of values from the /// [`EventMask`][crate::EventMask] enumeration. /// /// See the [input handling overview][event-masks] for details. /// ## `device` /// [`Device`][crate::Device] to enable events for. /// ## `event_mask` /// event mask for `self` #[doc(alias = "gdk_window_set_device_events")] pub fn set_device_events(&self, device: &Device, event_mask: EventMask) { unsafe { ffi::gdk_window_set_device_events( self.to_glib_none().0, device.to_glib_none().0, event_mask.into_glib(), ); } } /// Determines whether or not extra unprocessed motion events in /// the event queue can be discarded. If [`true`] only the most recent /// event will be delivered. /// /// Some types of applications, e.g. paint programs, need to see all /// motion events and will benefit from turning off event compression. /// /// By default, event compression is enabled. /// ## `event_compression` /// [`true`] if motion events should be compressed #[doc(alias = "gdk_window_set_event_compression")] pub fn set_event_compression(&self, event_compression: bool) { unsafe { ffi::gdk_window_set_event_compression( self.to_glib_none().0, event_compression.into_glib(), ); } } /// The event mask for a window determines which events will be reported /// for that window from all master input devices. For example, an event mask /// including [`EventMask::BUTTON_PRESS_MASK`][crate::EventMask::BUTTON_PRESS_MASK] means the window should report button /// press events. The event mask is the bitwise OR of values from the /// [`EventMask`][crate::EventMask] enumeration. /// /// See the [input handling overview][event-masks] for details. /// ## `event_mask` /// event mask for `self` #[doc(alias = "gdk_window_set_events")] pub fn set_events(&self, event_mask: EventMask) { unsafe { ffi::gdk_window_set_events(self.to_glib_none().0, event_mask.into_glib()); } } /// Setting `focus_on_map` to [`false`] hints the desktop environment that the /// window doesn’t want to receive input focus when it is mapped. /// focus_on_map should be turned off for windows that aren’t triggered /// interactively (such as popups from network activity). /// /// On X, it is the responsibility of the window manager to interpret /// this hint. Window managers following the freedesktop.org window /// manager extension specification should respect it. /// ## `focus_on_map` /// [`true`] if the window should receive input focus when mapped #[doc(alias = "gdk_window_set_focus_on_map")] pub fn set_focus_on_map(&self, focus_on_map: bool) { unsafe { ffi::gdk_window_set_focus_on_map(self.to_glib_none().0, focus_on_map.into_glib()); } } /// Specifies whether the `self` should span over all monitors (in a multi-head /// setup) or only the current monitor when in fullscreen mode. /// /// The `mode` argument is from the [`FullscreenMode`][crate::FullscreenMode] enumeration. /// If [`FullscreenMode::AllMonitors`][crate::FullscreenMode::AllMonitors] is specified, the fullscreen `self` will /// span over all monitors from the [`Screen`][crate::Screen]. /// /// On X11, searches through the list of monitors from the [`Screen`][crate::Screen] the ones /// which delimit the 4 edges of the entire [`Screen`][crate::Screen] and will ask the window /// manager to span the `self` over these monitors. /// /// If the XINERAMA extension is not available or not usable, this function /// has no effect. /// /// Not all window managers support this, so you can’t rely on the fullscreen /// window to span over the multiple monitors when [`FullscreenMode::AllMonitors`][crate::FullscreenMode::AllMonitors] /// is specified. /// ## `mode` /// fullscreen mode #[doc(alias = "gdk_window_set_fullscreen_mode")] pub fn set_fullscreen_mode(&self, mode: FullscreenMode) { unsafe { ffi::gdk_window_set_fullscreen_mode(self.to_glib_none().0, mode.into_glib()); } } /// Sets hints about the window management functions to make available /// via buttons on the window frame. /// /// On the X backend, this function sets the traditional Motif window /// manager hint for this purpose. However, few window managers do /// anything reliable or interesting with this hint. Many ignore it /// entirely. /// /// The `functions` argument is the logical OR of values from the /// [`WMFunction`][crate::WMFunction] enumeration. If the bitmask includes [`WMFunction::ALL`][crate::WMFunction::ALL], /// then the other bits indicate which functions to disable; if /// it doesn’t include [`WMFunction::ALL`][crate::WMFunction::ALL], it indicates which functions to /// enable. /// ## `functions` /// bitmask of operations to allow on `self` #[doc(alias = "gdk_window_set_functions")] pub fn set_functions(&self, functions: WMFunction) { unsafe { ffi::gdk_window_set_functions(self.to_glib_none().0, functions.into_glib()); } } /// Sets the geometry hints for `self`. Hints flagged in `geom_mask` /// are set, hints not flagged in `geom_mask` are unset. /// To unset all hints, use a `geom_mask` of 0 and a `geometry` of [`None`]. /// /// This function provides hints to the windowing system about /// acceptable sizes for a toplevel window. The purpose of /// this is to constrain user resizing, but the windowing system /// will typically (but is not required to) also constrain the /// current size of the window to the provided values and /// constrain programatic resizing via [`resize()`][Self::resize()] or /// [`move_resize()`][Self::move_resize()]. /// /// Note that on X11, this effect has no effect on windows /// of type [`WindowType::Temp`][crate::WindowType::Temp] or windows where override redirect /// has been turned on via [`set_override_redirect()`][Self::set_override_redirect()] /// since these windows are not resizable by the user. /// /// Since you can’t count on the windowing system doing the /// constraints for programmatic resizes, you should generally /// call [`constrain_size()`][Self::constrain_size()] yourself to determine /// appropriate sizes. /// ## `geometry` /// geometry hints /// ## `geom_mask` /// bitmask indicating fields of `geometry` to pay attention to #[doc(alias = "gdk_window_set_geometry_hints")] pub fn set_geometry_hints(&self, geometry: &Geometry, geom_mask: WindowHints) { unsafe { ffi::gdk_window_set_geometry_hints( self.to_glib_none().0, geometry.to_glib_none().0, geom_mask.into_glib(), ); } } /// Sets the group leader window for `self`. By default, /// GDK sets the group leader for all toplevel windows /// to a global window implicitly created by GDK. With this function /// you can override this default. /// /// The group leader window allows the window manager to distinguish /// all windows that belong to a single application. It may for example /// allow users to minimize/unminimize all windows belonging to an /// application at once. You should only set a non-default group window /// if your application pretends to be multiple applications. /// ## `leader` /// group leader window, or [`None`] to restore the default group leader window #[doc(alias = "gdk_window_set_group")] pub fn set_group(&self, leader: Option<&Window>) { unsafe { ffi::gdk_window_set_group(self.to_glib_none().0, leader.to_glib_none().0); } } /// Sets a list of icons for the window. One of these will be used /// to represent the window when it has been iconified. The icon is /// usually shown in an icon box or some sort of task bar. Which icon /// size is shown depends on the window manager. The window manager /// can scale the icon but setting several size icons can give better /// image quality since the window manager may only need to scale the /// icon by a small amount or not at all. /// /// Note that some platforms don't support window icons. /// ## `pixbufs` /// /// A list of pixbufs, of different sizes. #[doc(alias = "gdk_window_set_icon_list")] pub fn set_icon_list(&self, pixbufs: &[gdk_pixbuf::Pixbuf]) { unsafe { ffi::gdk_window_set_icon_list(self.to_glib_none().0, pixbufs.to_glib_none().0); } } /// Windows may have a name used while minimized, distinct from the /// name they display in their titlebar. Most of the time this is a bad /// idea from a user interface standpoint. But you can set such a name /// with this function, if you like. /// /// After calling this with a non-[`None`] `name`, calls to [`set_title()`][Self::set_title()] /// will not update the icon title. /// /// Using [`None`] for `name` unsets the icon title; further calls to /// [`set_title()`][Self::set_title()] will again update the icon title as well. /// /// Note that some platforms don't support window icons. /// ## `name` /// name of window while iconified (minimized) #[doc(alias = "gdk_window_set_icon_name")] pub fn set_icon_name(&self, name: Option<&str>) { unsafe { ffi::gdk_window_set_icon_name(self.to_glib_none().0, name.to_glib_none().0); } } //#[doc(alias = "gdk_window_set_invalidate_handler")] //pub fn set_invalidate_handler<P: Fn(&Window, &cairo::Region) + 'static>(&self, handler: P) { // unsafe { TODO: call ffi:gdk_window_set_invalidate_handler() } //} /// Set if `self` must be kept above other windows. If the /// window was already above, then this function does nothing. /// /// On X11, asks the window manager to keep `self` above, if the window /// manager supports this operation. Not all window managers support /// this, and some deliberately ignore it or don’t have a concept of /// “keep above”; so you can’t rely on the window being kept above. /// But it will happen with most standard window managers, /// and GDK makes a best effort to get it to happen. /// ## `setting` /// whether to keep `self` above other windows #[doc(alias = "gdk_window_set_keep_above")] pub fn set_keep_above(&self, setting: bool) { unsafe { ffi::gdk_window_set_keep_above(self.to_glib_none().0, setting.into_glib()); } } /// Set if `self` must be kept below other windows. If the /// window was already below, then this function does nothing. /// /// On X11, asks the window manager to keep `self` below, if the window /// manager supports this operation. Not all window managers support /// this, and some deliberately ignore it or don’t have a concept of /// “keep below”; so you can’t rely on the window being kept below. /// But it will happen with most standard window managers, /// and GDK makes a best effort to get it to happen. /// ## `setting` /// whether to keep `self` below other windows #[doc(alias = "gdk_window_set_keep_below")] pub fn set_keep_below(&self, setting: bool) { unsafe { ffi::gdk_window_set_keep_below(self.to_glib_none().0, setting.into_glib()); } } /// The application can use this hint to tell the window manager /// that a certain window has modal behaviour. The window manager /// can use this information to handle modal windows in a special /// way. /// /// You should only use this on windows for which you have /// previously called [`set_transient_for()`][Self::set_transient_for()] /// ## `modal` /// [`true`] if the window is modal, [`false`] otherwise. #[doc(alias = "gdk_window_set_modal_hint")] pub fn set_modal_hint(&self, modal: bool) { unsafe { ffi::gdk_window_set_modal_hint(self.to_glib_none().0, modal.into_glib()); } } /// Set `self` to render as partially transparent, /// with opacity 0 being fully transparent and 1 fully opaque. (Values /// of the opacity parameter are clamped to the [0,1] range.) /// /// For toplevel windows this depends on support from the windowing system /// that may not always be there. For instance, On X11, this works only on /// X screens with a compositing manager running. On Wayland, there is no /// per-window opacity value that the compositor would apply. Instead, use /// `gdk_window_set_opaque_region (window, NULL)` to tell the compositor /// that the entire window is (potentially) non-opaque, and draw your content /// with alpha, or use `gtk_widget_set_opacity()` to set an overall opacity /// for your widgets. /// /// For child windows this function only works for non-native windows. /// /// For setting up per-pixel alpha topelevels, see [`Screen::rgba_visual()`][crate::Screen::rgba_visual()], /// and for non-toplevels, see `gdk_window_set_composited()`. /// /// Support for non-toplevel windows was added in 3.8. /// ## `opacity` /// opacity #[doc(alias = "gdk_window_set_opacity")] pub fn set_opacity(&self, opacity: f64) { unsafe { ffi::gdk_window_set_opacity(self.to_glib_none().0, opacity); } } /// For optimisation purposes, compositing window managers may /// like to not draw obscured regions of windows, or turn off blending /// during for these regions. With RGB windows with no transparency, /// this is just the shape of the window, but with ARGB32 windows, the /// compositor does not know what regions of the window are transparent /// or not. /// /// This function only works for toplevel windows. /// /// GTK+ will update this property automatically if /// the `self` background is opaque, as we know where the opaque regions /// are. If your window background is not opaque, please update this /// property in your `GtkWidget::style-updated` handler. /// ## `region` /// a region, or [`None`] #[doc(alias = "gdk_window_set_opaque_region")] pub fn set_opaque_region(&self, region: Option<&cairo::Region>) { unsafe { ffi::gdk_window_set_opaque_region( self.to_glib_none().0, mut_override(region.to_glib_none().0), ); } } /// An override redirect window is not under the control of the window manager. /// This means it won’t have a titlebar, won’t be minimizable, etc. - it will /// be entirely under the control of the application. The window manager /// can’t see the override redirect window at all. /// /// Override redirect should only be used for short-lived temporary /// windows, such as popup menus. `GtkMenu` uses an override redirect /// window in its implementation, for example. /// ## `override_redirect` /// [`true`] if window should be override redirect #[doc(alias = "gdk_window_set_override_redirect")] pub fn set_override_redirect(&self, override_redirect: bool) { unsafe { ffi::gdk_window_set_override_redirect( self.to_glib_none().0, override_redirect.into_glib(), ); } } /// Sets whether input to the window is passed through to the window /// below. /// /// The default value of this is [`false`], which means that pointer /// events that happen inside the window are send first to the window, /// but if the event is not selected by the event mask then the event /// is sent to the parent window, and so on up the hierarchy. /// /// If `pass_through` is [`true`] then such pointer events happen as if the /// window wasn't there at all, and thus will be sent first to any /// windows below `self`. This is useful if the window is used in a /// transparent fashion. In the terminology of the web this would be called /// "pointer-events: none". /// /// Note that a window with `pass_through` [`true`] can still have a subwindow /// without pass through, so you can get events on a subset of a window. And in /// that cases you would get the in-between related events such as the pointer /// enter/leave events on its way to the destination window. /// ## `pass_through` /// a boolean #[doc(alias = "gdk_window_set_pass_through")] pub fn set_pass_through(&self, pass_through: bool) { unsafe { ffi::gdk_window_set_pass_through(self.to_glib_none().0, pass_through.into_glib()); } } /// When using GTK+, typically you should use `gtk_window_set_role()` instead /// of this low-level function. /// /// The window manager and session manager use a window’s role to /// distinguish it from other kinds of window in the same application. /// When an application is restarted after being saved in a previous /// session, all windows with the same title and role are treated as /// interchangeable. So if you have two windows with the same title /// that should be distinguished for session management purposes, you /// should set the role on those windows. It doesn’t matter what string /// you use for the role, as long as you have a different role for each /// non-interchangeable kind of window. /// ## `role` /// a string indicating its role #[doc(alias = "gdk_window_set_role")] pub fn set_role(&self, role: &str) { unsafe { ffi::gdk_window_set_role(self.to_glib_none().0, role.to_glib_none().0); } } /// Newer GTK+ windows using client-side decorations use extra geometry /// around their frames for effects like shadows and invisible borders. /// Window managers that want to maximize windows or snap to edges need /// to know where the extents of the actual frame lie, so that users /// don’t feel like windows are snapping against random invisible edges. /// /// Note that this property is automatically updated by GTK+, so this /// function should only be used by applications which do not use GTK+ /// to create toplevel windows. /// ## `left` /// The left extent /// ## `right` /// The right extent /// ## `top` /// The top extent /// ## `bottom` /// The bottom extent #[doc(alias = "gdk_window_set_shadow_width")] pub fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32) { unsafe { ffi::gdk_window_set_shadow_width(self.to_glib_none().0, left, right, top, bottom); } } /// Toggles whether a window should appear in a pager (workspace /// switcher, or other desktop utility program that displays a small /// thumbnail representation of the windows on the desktop). If a /// window’s semantic type as specified with [`set_type_hint()`][Self::set_type_hint()] /// already fully describes the window, this function should /// not be called in addition, instead you should /// allow the window to be treated according to standard policy for /// its semantic type. /// ## `skips_pager` /// [`true`] to skip the pager #[doc(alias = "gdk_window_set_skip_pager_hint")] pub fn set_skip_pager_hint(&self, skips_pager: bool) { unsafe { ffi::gdk_window_set_skip_pager_hint(self.to_glib_none().0, skips_pager.into_glib()); } } /// Toggles whether a window should appear in a task list or window /// list. If a window’s semantic type as specified with /// [`set_type_hint()`][Self::set_type_hint()] already fully describes the window, this /// function should not be called in addition, /// instead you should allow the window to be treated according to /// standard policy for its semantic type. /// ## `skips_taskbar` /// [`true`] to skip the taskbar #[doc(alias = "gdk_window_set_skip_taskbar_hint")] pub fn set_skip_taskbar_hint(&self, skips_taskbar: bool) { unsafe { ffi::gdk_window_set_skip_taskbar_hint(self.to_glib_none().0, skips_taskbar.into_glib()); } } /// Sets the event mask for any floating device (i.e. not attached to any /// visible pointer) that has the source defined as `source`. This event /// mask will be applied both to currently existing, newly added devices /// after this call, and devices being attached/detached. /// ## `source` /// a [`InputSource`][crate::InputSource] to define the source class. /// ## `event_mask` /// event mask for `self` #[doc(alias = "gdk_window_set_source_events")] pub fn set_source_events(&self, source: InputSource, event_mask: EventMask) { unsafe { ffi::gdk_window_set_source_events( self.to_glib_none().0, source.into_glib(), event_mask.into_glib(), ); } } /// When using GTK+, typically you should use `gtk_window_set_startup_id()` /// instead of this low-level function. /// ## `startup_id` /// a string with startup-notification identifier #[doc(alias = "gdk_window_set_startup_id")] pub fn set_startup_id(&self, startup_id: &str) { unsafe { ffi::gdk_window_set_startup_id(self.to_glib_none().0, startup_id.to_glib_none().0); } } /// This function will enable multidevice features in `self`. /// /// Multidevice aware windows will need to handle properly multiple, /// per device enter/leave events, device grabs and grab ownerships. /// ## `support_multidevice` /// [`true`] to enable multidevice support in `self`. #[doc(alias = "gdk_window_set_support_multidevice")] pub fn set_support_multidevice(&self, support_multidevice: bool) { unsafe { ffi::gdk_window_set_support_multidevice( self.to_glib_none().0, support_multidevice.into_glib(), ); } } /// Sets the title of a toplevel window, to be displayed in the titlebar. /// If you haven’t explicitly set the icon name for the window /// (using [`set_icon_name()`][Self::set_icon_name()]), the icon name will be set to /// `title` as well. `title` must be in UTF-8 encoding (as with all /// user-readable strings in GDK/GTK+). `title` may not be [`None`]. /// ## `title` /// title of `self` #[doc(alias = "gdk_window_set_title")] pub fn set_title(&self, title: &str) { unsafe { ffi::gdk_window_set_title(self.to_glib_none().0, title.to_glib_none().0); } } /// Indicates to the window manager that `self` is a transient dialog /// associated with the application window `parent`. This allows the /// window manager to do things like center `self` on `parent` and /// keep `self` above `parent`. /// /// See `gtk_window_set_transient_for()` if you’re using `GtkWindow` or /// `GtkDialog`. /// ## `parent` /// another toplevel [`Window`][crate::Window] #[doc(alias = "gdk_window_set_transient_for")] pub fn set_transient_for(&self, parent: &Window) { unsafe { ffi::gdk_window_set_transient_for(self.to_glib_none().0, parent.to_glib_none().0); } } /// The application can use this call to provide a hint to the window /// manager about the functionality of a window. The window manager /// can use this information when determining the decoration and behaviour /// of the window. /// /// The hint must be set before the window is mapped. /// ## `hint` /// A hint of the function this window will have #[doc(alias = "gdk_window_set_type_hint")] pub fn set_type_hint(&self, hint: WindowTypeHint) { unsafe { ffi::gdk_window_set_type_hint(self.to_glib_none().0, hint.into_glib()); } } /// Toggles whether a window needs the user's /// urgent attention. /// ## `urgent` /// [`true`] if the window is urgent #[doc(alias = "gdk_window_set_urgency_hint")] pub fn set_urgency_hint(&self, urgent: bool) { unsafe { ffi::gdk_window_set_urgency_hint(self.to_glib_none().0, urgent.into_glib()); } } /// Makes pixels in `self` outside `shape_region` be transparent, /// so that the window may be nonrectangular. /// /// If `shape_region` is [`None`], the shape will be unset, so the whole /// window will be opaque again. `offset_x` and `offset_y` are ignored /// if `shape_region` is [`None`]. /// /// On the X11 platform, this uses an X server extension which is /// widely available on most common platforms, but not available on /// very old X servers, and occasionally the implementation will be /// buggy. On servers without the shape extension, this function /// will do nothing. /// /// This function works on both toplevel and child windows. /// ## `shape_region` /// region of window to be non-transparent /// ## `offset_x` /// X position of `shape_region` in `self` coordinates /// ## `offset_y` /// Y position of `shape_region` in `self` coordinates #[doc(alias = "gdk_window_shape_combine_region")] pub fn shape_combine_region( &self, shape_region: Option<&cairo::Region>, offset_x: i32, offset_y: i32, ) { unsafe { ffi::gdk_window_shape_combine_region( self.to_glib_none().0, shape_region.to_glib_none().0, offset_x, offset_y, ); } } /// Like [`show_unraised()`][Self::show_unraised()], but also raises the window to the /// top of the window stack (moves the window to the front of the /// Z-order). /// /// This function maps a window so it’s visible onscreen. Its opposite /// is [`hide()`][Self::hide()]. /// /// When implementing a `GtkWidget`, you should call this function on the widget's /// [`Window`][crate::Window] as part of the “map” method. #[doc(alias = "gdk_window_show")] pub fn show(&self) { unsafe { ffi::gdk_window_show(self.to_glib_none().0); } } /// Shows a [`Window`][crate::Window] onscreen, but does not modify its stacking /// order. In contrast, [`show()`][Self::show()] will raise the window /// to the top of the window stack. /// /// On the X11 platform, in Xlib terms, this function calls /// XMapWindow() (it also updates some internal GDK state, which means /// that you can’t really use XMapWindow() directly on a GDK window). #[doc(alias = "gdk_window_show_unraised")] pub fn show_unraised(&self) { unsafe { ffi::gdk_window_show_unraised(self.to_glib_none().0); } } /// Asks the windowing system to show the window menu. The window menu /// is the menu shown when right-clicking the titlebar on traditional /// windows managed by the window manager. This is useful for windows /// using client-side decorations, activating it with a right-click /// on the window decorations. /// ## `event` /// a `GdkEvent` to show the menu for /// /// # Returns /// /// [`true`] if the window menu was shown and [`false`] otherwise. #[doc(alias = "gdk_window_show_window_menu")] pub fn show_window_menu(&self, event: &mut Event) -> bool { unsafe { from_glib(ffi::gdk_window_show_window_menu( self.to_glib_none().0, event.to_glib_none_mut().0, )) } } /// “Pins” a window such that it’s on all workspaces and does not scroll /// with viewports, for window managers that have scrollable viewports. /// (When using `GtkWindow`, `gtk_window_stick()` may be more useful.) /// /// On the X11 platform, this function depends on window manager /// support, so may have no effect with many window managers. However, /// GDK will do the best it can to convince the window manager to stick /// the window. For window managers that don’t support this operation, /// there’s nothing you can do to force it to happen. #[doc(alias = "gdk_window_stick")] pub fn stick(&self) { unsafe { ffi::gdk_window_stick(self.to_glib_none().0); } } /// Thaws a window frozen with [`freeze_updates()`][Self::freeze_updates()]. #[doc(alias = "gdk_window_thaw_updates")] pub fn thaw_updates(&self) { unsafe { ffi::gdk_window_thaw_updates(self.to_glib_none().0); } } /// Moves the window out of fullscreen mode. If the window was not /// fullscreen, does nothing. /// /// On X11, asks the window manager to move `self` out of the fullscreen /// state, if the window manager supports this operation. Not all /// window managers support this, and some deliberately ignore it or /// don’t have a concept of “fullscreen”; so you can’t rely on the /// unfullscreenification actually happening. But it will happen with /// most standard window managers, and GDK makes a best effort to get /// it to happen. #[doc(alias = "gdk_window_unfullscreen")] pub fn unfullscreen(&self) { unsafe { ffi::gdk_window_unfullscreen(self.to_glib_none().0); } } /// Unmaximizes the window. If the window wasn’t maximized, then this /// function does nothing. /// /// On X11, asks the window manager to unmaximize `self`, if the /// window manager supports this operation. Not all window managers /// support this, and some deliberately ignore it or don’t have a /// concept of “maximized”; so you can’t rely on the unmaximization /// actually happening. But it will happen with most standard window /// managers, and GDK makes a best effort to get it to happen. /// /// On Windows, reliably unmaximizes the window. #[doc(alias = "gdk_window_unmaximize")] pub fn unmaximize(&self) { unsafe { ffi::gdk_window_unmaximize(self.to_glib_none().0); } } /// Reverse operation for [`stick()`][Self::stick()]; see [`stick()`][Self::stick()], /// and `gtk_window_unstick()`. #[doc(alias = "gdk_window_unstick")] pub fn unstick(&self) { unsafe { ffi::gdk_window_unstick(self.to_glib_none().0); } } /// Withdraws a window (unmaps it and asks the window manager to forget about it). /// This function is not really useful as [`hide()`][Self::hide()] automatically /// withdraws toplevel windows before hiding them. #[doc(alias = "gdk_window_withdraw")] pub fn withdraw(&self) { unsafe { ffi::gdk_window_withdraw(self.to_glib_none().0); } } /// Constrains a desired width and height according to a /// set of geometry hints (such as minimum and maximum size). /// ## `geometry` /// a [`Geometry`][crate::Geometry] structure /// ## `flags` /// a mask indicating what portions of `geometry` are set /// ## `width` /// desired width of window /// ## `height` /// desired height of the window /// /// # Returns /// /// /// ## `new_width` /// location to store resulting width /// /// ## `new_height` /// location to store resulting height #[doc(alias = "gdk_window_constrain_size")] pub fn constrain_size( geometry: &mut Geometry, flags: WindowHints, width: i32, height: i32, ) -> (i32, i32) { assert_initialized_main_thread!(); unsafe { let mut new_width = mem::MaybeUninit::uninit(); let mut new_height = mem::MaybeUninit::uninit(); ffi::gdk_window_constrain_size( geometry.to_glib_none_mut().0, flags.into_glib(), width, height, new_width.as_mut_ptr(), new_height.as_mut_ptr(), ); let new_width = new_width.assume_init(); let new_height = new_height.assume_init(); (new_width, new_height) } } /// Calls [`process_updates()`][Self::process_updates()] for all windows (see [`Window`][crate::Window]) /// in the application. /// /// # Deprecated since 3.22 /// #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] #[doc(alias = "gdk_window_process_all_updates")] pub fn process_all_updates() { assert_initialized_main_thread!(); unsafe { ffi::gdk_window_process_all_updates(); } } /// With update debugging enabled, calls to /// [`invalidate_region()`][Self::invalidate_region()] clear the invalidated region of the /// screen to a noticeable color, and GDK pauses for a short time /// before sending exposes to windows during /// [`process_updates()`][Self::process_updates()]. The net effect is that you can see /// the invalid region for each window and watch redraws as they /// occur. This allows you to diagnose inefficiencies in your application. /// /// In essence, because the GDK rendering model prevents all flicker, /// if you are redrawing the same region 400 times you may never /// notice, aside from noticing a speed problem. Enabling update /// debugging causes GTK to flicker slowly and noticeably, so you can /// see exactly what’s being redrawn when, in what order. /// /// The --gtk-debug=updates command line option passed to GTK+ programs /// enables this debug option at application startup time. That's /// usually more useful than calling [`set_debug_updates()`][Self::set_debug_updates()] /// yourself, though you might want to use this function to enable /// updates sometime after application startup time. /// /// # Deprecated since 3.22 /// /// ## `setting` /// [`true`] to turn on update debugging #[cfg_attr(feature = "v3_22", deprecated = "Since 3.22")] #[doc(alias = "gdk_window_set_debug_updates")] pub fn set_debug_updates(setting: bool) { assert_initialized_main_thread!(); unsafe { ffi::gdk_window_set_debug_updates(setting.into_glib()); } } /// The ::create-surface signal is emitted when an offscreen window /// needs its surface (re)created, which happens either when the /// window is first drawn to, or when the window is being /// resized. The first signal handler that returns a non-[`None`] /// surface will stop any further signal emission, and its surface /// will be used. /// /// Note that it is not possible to access the window's previous /// surface from within any callback of this signal. Calling /// `gdk_offscreen_window_get_surface()` will lead to a crash. /// ## `width` /// the width of the offscreen surface to create /// ## `height` /// the height of the offscreen surface to create /// /// # Returns /// /// the newly created [`cairo::Surface`][crate::cairo::Surface] for the offscreen window #[doc(alias = "create-surface")] pub fn connect_create_surface<F: Fn(&Self, i32, i32) -> cairo::Surface + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn create_surface_trampoline< F: Fn(&Window, i32, i32) -> cairo::Surface + 'static, >( this: *mut ffi::GdkWindow, width: libc::c_int, height: libc::c_int, f: glib::ffi::gpointer, ) -> *mut cairo::ffi::cairo_surface_t { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), width, height).to_glib_full() } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"create-surface\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( create_surface_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } //#[doc(alias = "from-embedder")] //pub fn connect_from_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId { // Out offscreen_x: *.Double // Out offscreen_y: *.Double //} //#[cfg(any(feature = "v3_22", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] //#[doc(alias = "moved-to-rect")] //pub fn connect_moved_to_rect<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId { // Unimplemented flipped_rect: *.Pointer // Unimplemented final_rect: *.Pointer //} /// The ::pick-embedded-child signal is emitted to find an embedded /// child at the given position. /// ## `x` /// x coordinate in the window /// ## `y` /// y coordinate in the window /// /// # Returns /// /// the [`Window`][crate::Window] of the /// embedded child at `x`, `y`, or [`None`] #[doc(alias = "pick-embedded-child")] pub fn connect_pick_embedded_child<F: Fn(&Self, f64, f64) -> Option<Window> + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn pick_embedded_child_trampoline< F: Fn(&Window, f64, f64) -> Option<Window> + 'static, >( this: *mut ffi::GdkWindow, x: libc::c_double, y: libc::c_double, f: glib::ffi::gpointer, ) -> *mut ffi::GdkWindow { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), x, y) /*Not checked*/ .to_glib_none() .0 } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"pick-embedded-child\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( pick_embedded_child_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } //#[doc(alias = "to-embedder")] //pub fn connect_to_embedder<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId { // Out embedder_x: *.Double // Out embedder_y: *.Double //} #[doc(alias = "cursor")] pub fn connect_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_cursor_trampoline<F: Fn(&Window) + 'static>( this: *mut ffi::GdkWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::cursor\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_cursor_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Window { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Window") } }