1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
// 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

use gdk_sys;
use glib::error::ErrorDomain;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::Quark;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use std::fmt;

/// An enumeration describing the way in which a device
/// axis (valuator) maps onto the predefined valuator
/// types that GTK+ understands.
///
/// Note that the X and Y axes are not really needed; pointer devices
/// report their location via the x/y members of events regardless. Whether
/// X and Y are present as axes depends on the GDK backend.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum AxisUse {
    /// the axis is ignored.
    Ignore,
    /// the axis is used as the x axis.
    X,
    /// the axis is used as the y axis.
    Y,
    /// the axis is used for pressure information.
    Pressure,
    /// the axis is used for x tilt information.
    Xtilt,
    /// the axis is used for y tilt information.
    Ytilt,
    /// the axis is used for wheel information.
    Wheel,
    /// the axis is used for pen/tablet distance information. (Since: 3.22)
    Distance,
    /// the axis is used for pen rotation information. (Since: 3.22)
    Rotation,
    /// the axis is used for pen slider information. (Since: 3.22)
    Slider,
    /// a constant equal to the numerically highest axis value.
    Last,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for AxisUse {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "AxisUse::{}",
            match *self {
                AxisUse::Ignore => "Ignore",
                AxisUse::X => "X",
                AxisUse::Y => "Y",
                AxisUse::Pressure => "Pressure",
                AxisUse::Xtilt => "Xtilt",
                AxisUse::Ytilt => "Ytilt",
                AxisUse::Wheel => "Wheel",
                AxisUse::Distance => "Distance",
                AxisUse::Rotation => "Rotation",
                AxisUse::Slider => "Slider",
                AxisUse::Last => "Last",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for AxisUse {
    type GlibType = gdk_sys::GdkAxisUse;

    fn to_glib(&self) -> gdk_sys::GdkAxisUse {
        match *self {
            AxisUse::Ignore => gdk_sys::GDK_AXIS_IGNORE,
            AxisUse::X => gdk_sys::GDK_AXIS_X,
            AxisUse::Y => gdk_sys::GDK_AXIS_Y,
            AxisUse::Pressure => gdk_sys::GDK_AXIS_PRESSURE,
            AxisUse::Xtilt => gdk_sys::GDK_AXIS_XTILT,
            AxisUse::Ytilt => gdk_sys::GDK_AXIS_YTILT,
            AxisUse::Wheel => gdk_sys::GDK_AXIS_WHEEL,
            AxisUse::Distance => gdk_sys::GDK_AXIS_DISTANCE,
            AxisUse::Rotation => gdk_sys::GDK_AXIS_ROTATION,
            AxisUse::Slider => gdk_sys::GDK_AXIS_SLIDER,
            AxisUse::Last => gdk_sys::GDK_AXIS_LAST,
            AxisUse::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkAxisUse> for AxisUse {
    fn from_glib(value: gdk_sys::GdkAxisUse) -> Self {
        skip_assert_initialized!();
        match value {
            0 => AxisUse::Ignore,
            1 => AxisUse::X,
            2 => AxisUse::Y,
            3 => AxisUse::Pressure,
            4 => AxisUse::Xtilt,
            5 => AxisUse::Ytilt,
            6 => AxisUse::Wheel,
            7 => AxisUse::Distance,
            8 => AxisUse::Rotation,
            9 => AxisUse::Slider,
            10 => AxisUse::Last,
            value => AxisUse::__Unknown(value),
        }
    }
}

impl StaticType for AxisUse {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_axis_use_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for AxisUse {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for AxisUse {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for AxisUse {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// A set of values describing the possible byte-orders
/// for storing pixel values in memory.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum ByteOrder {
    /// The values are stored with the least-significant byte
    ///  first. For instance, the 32-bit value 0xffeecc would be stored
    ///  in memory as 0xcc, 0xee, 0xff, 0x00.
    LsbFirst,
    /// The values are stored with the most-significant byte
    ///  first. For instance, the 32-bit value 0xffeecc would be stored
    ///  in memory as 0x00, 0xff, 0xee, 0xcc.
    MsbFirst,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for ByteOrder {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "ByteOrder::{}",
            match *self {
                ByteOrder::LsbFirst => "LsbFirst",
                ByteOrder::MsbFirst => "MsbFirst",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for ByteOrder {
    type GlibType = gdk_sys::GdkByteOrder;

    fn to_glib(&self) -> gdk_sys::GdkByteOrder {
        match *self {
            ByteOrder::LsbFirst => gdk_sys::GDK_LSB_FIRST,
            ByteOrder::MsbFirst => gdk_sys::GDK_MSB_FIRST,
            ByteOrder::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkByteOrder> for ByteOrder {
    fn from_glib(value: gdk_sys::GdkByteOrder) -> Self {
        skip_assert_initialized!();
        match value {
            0 => ByteOrder::LsbFirst,
            1 => ByteOrder::MsbFirst,
            value => ByteOrder::__Unknown(value),
        }
    }
}

impl StaticType for ByteOrder {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_byte_order_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for ByteOrder {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for ByteOrder {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for ByteOrder {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies the crossing mode for `EventCrossing`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum CrossingMode {
    /// crossing because of pointer motion.
    Normal,
    /// crossing because a grab is activated.
    Grab,
    /// crossing because a grab is deactivated.
    Ungrab,
    /// crossing because a GTK+ grab is activated.
    GtkGrab,
    /// crossing because a GTK+ grab is deactivated.
    GtkUngrab,
    /// crossing because a GTK+ widget changed
    ///  state (e.g. sensitivity).
    StateChanged,
    /// crossing because a touch sequence has begun,
    ///  this event is synthetic as the pointer might have not left the window.
    TouchBegin,
    /// crossing because a touch sequence has ended,
    ///  this event is synthetic as the pointer might have not left the window.
    TouchEnd,
    /// crossing because of a device switch (i.e.
    ///  a mouse taking control of the pointer after a touch device), this event
    ///  is synthetic as the pointer didn’t leave the window.
    DeviceSwitch,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for CrossingMode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "CrossingMode::{}",
            match *self {
                CrossingMode::Normal => "Normal",
                CrossingMode::Grab => "Grab",
                CrossingMode::Ungrab => "Ungrab",
                CrossingMode::GtkGrab => "GtkGrab",
                CrossingMode::GtkUngrab => "GtkUngrab",
                CrossingMode::StateChanged => "StateChanged",
                CrossingMode::TouchBegin => "TouchBegin",
                CrossingMode::TouchEnd => "TouchEnd",
                CrossingMode::DeviceSwitch => "DeviceSwitch",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for CrossingMode {
    type GlibType = gdk_sys::GdkCrossingMode;

    fn to_glib(&self) -> gdk_sys::GdkCrossingMode {
        match *self {
            CrossingMode::Normal => gdk_sys::GDK_CROSSING_NORMAL,
            CrossingMode::Grab => gdk_sys::GDK_CROSSING_GRAB,
            CrossingMode::Ungrab => gdk_sys::GDK_CROSSING_UNGRAB,
            CrossingMode::GtkGrab => gdk_sys::GDK_CROSSING_GTK_GRAB,
            CrossingMode::GtkUngrab => gdk_sys::GDK_CROSSING_GTK_UNGRAB,
            CrossingMode::StateChanged => gdk_sys::GDK_CROSSING_STATE_CHANGED,
            CrossingMode::TouchBegin => gdk_sys::GDK_CROSSING_TOUCH_BEGIN,
            CrossingMode::TouchEnd => gdk_sys::GDK_CROSSING_TOUCH_END,
            CrossingMode::DeviceSwitch => gdk_sys::GDK_CROSSING_DEVICE_SWITCH,
            CrossingMode::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkCrossingMode> for CrossingMode {
    fn from_glib(value: gdk_sys::GdkCrossingMode) -> Self {
        skip_assert_initialized!();
        match value {
            0 => CrossingMode::Normal,
            1 => CrossingMode::Grab,
            2 => CrossingMode::Ungrab,
            3 => CrossingMode::GtkGrab,
            4 => CrossingMode::GtkUngrab,
            5 => CrossingMode::StateChanged,
            6 => CrossingMode::TouchBegin,
            7 => CrossingMode::TouchEnd,
            8 => CrossingMode::DeviceSwitch,
            value => CrossingMode::__Unknown(value),
        }
    }
}

impl StaticType for CrossingMode {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_crossing_mode_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for CrossingMode {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for CrossingMode {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for CrossingMode {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Predefined cursors.
///
/// Note that these IDs are directly taken from the X cursor font, and many
/// of these cursors are either not useful, or are not available on other platforms.
///
/// The recommended way to create cursors is to use `Cursor::new_from_name`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum CursorType {
    /// ![](X_cursor.png)
    XCursor,
    /// ![](arrow.png)
    Arrow,
    /// ![](based_arrow_down.png)
    BasedArrowDown,
    /// ![](based_arrow_up.png)
    BasedArrowUp,
    /// ![](boat.png)
    Boat,
    /// ![](bogosity.png)
    Bogosity,
    /// ![](bottom_left_corner.png)
    BottomLeftCorner,
    /// ![](bottom_right_corner.png)
    BottomRightCorner,
    /// ![](bottom_side.png)
    BottomSide,
    /// ![](bottom_tee.png)
    BottomTee,
    /// ![](box_spiral.png)
    BoxSpiral,
    /// ![](center_ptr.png)
    CenterPtr,
    /// ![](circle.png)
    Circle,
    /// ![](clock.png)
    Clock,
    /// ![](coffee_mug.png)
    CoffeeMug,
    /// ![](cross.png)
    Cross,
    /// ![](cross_reverse.png)
    CrossReverse,
    /// ![](crosshair.png)
    Crosshair,
    /// ![](diamond_cross.png)
    DiamondCross,
    /// ![](dot.png)
    Dot,
    /// ![](dotbox.png)
    Dotbox,
    /// ![](double_arrow.png)
    DoubleArrow,
    /// ![](draft_large.png)
    DraftLarge,
    /// ![](draft_small.png)
    DraftSmall,
    /// ![](draped_box.png)
    DrapedBox,
    /// ![](exchange.png)
    Exchange,
    /// ![](fleur.png)
    Fleur,
    /// ![](gobbler.png)
    Gobbler,
    /// ![](gumby.png)
    Gumby,
    /// ![](hand1.png)
    Hand1,
    /// ![](hand2.png)
    Hand2,
    /// ![](heart.png)
    Heart,
    /// ![](icon.png)
    Icon,
    /// ![](iron_cross.png)
    IronCross,
    /// ![](left_ptr.png)
    LeftPtr,
    /// ![](left_side.png)
    LeftSide,
    /// ![](left_tee.png)
    LeftTee,
    /// ![](leftbutton.png)
    Leftbutton,
    /// ![](ll_angle.png)
    LlAngle,
    /// ![](lr_angle.png)
    LrAngle,
    /// ![](man.png)
    Man,
    /// ![](middlebutton.png)
    Middlebutton,
    /// ![](mouse.png)
    Mouse,
    /// ![](pencil.png)
    Pencil,
    /// ![](pirate.png)
    Pirate,
    /// ![](plus.png)
    Plus,
    /// ![](question_arrow.png)
    QuestionArrow,
    /// ![](right_ptr.png)
    RightPtr,
    /// ![](right_side.png)
    RightSide,
    /// ![](right_tee.png)
    RightTee,
    /// ![](rightbutton.png)
    Rightbutton,
    /// ![](rtl_logo.png)
    RtlLogo,
    /// ![](sailboat.png)
    Sailboat,
    /// ![](sb_down_arrow.png)
    SbDownArrow,
    /// ![](sb_h_double_arrow.png)
    SbHDoubleArrow,
    /// ![](sb_left_arrow.png)
    SbLeftArrow,
    /// ![](sb_right_arrow.png)
    SbRightArrow,
    /// ![](sb_up_arrow.png)
    SbUpArrow,
    /// ![](sb_v_double_arrow.png)
    SbVDoubleArrow,
    /// ![](shuttle.png)
    Shuttle,
    /// ![](sizing.png)
    Sizing,
    /// ![](spider.png)
    Spider,
    /// ![](spraycan.png)
    Spraycan,
    /// ![](star.png)
    Star,
    /// ![](target.png)
    Target,
    /// ![](tcross.png)
    Tcross,
    /// ![](top_left_arrow.png)
    TopLeftArrow,
    /// ![](top_left_corner.png)
    TopLeftCorner,
    /// ![](top_right_corner.png)
    TopRightCorner,
    /// ![](top_side.png)
    TopSide,
    /// ![](top_tee.png)
    TopTee,
    /// ![](trek.png)
    Trek,
    /// ![](ul_angle.png)
    UlAngle,
    /// ![](umbrella.png)
    Umbrella,
    /// ![](ur_angle.png)
    UrAngle,
    /// ![](watch.png)
    Watch,
    /// ![](xterm.png)
    Xterm,
    /// last cursor type
    LastCursor,
    /// Blank cursor. Since 2.16
    BlankCursor,
    /// type of cursors constructed with
    ///  `Cursor::new_from_pixbuf`
    CursorIsPixmap,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for CursorType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "CursorType::{}",
            match *self {
                CursorType::XCursor => "XCursor",
                CursorType::Arrow => "Arrow",
                CursorType::BasedArrowDown => "BasedArrowDown",
                CursorType::BasedArrowUp => "BasedArrowUp",
                CursorType::Boat => "Boat",
                CursorType::Bogosity => "Bogosity",
                CursorType::BottomLeftCorner => "BottomLeftCorner",
                CursorType::BottomRightCorner => "BottomRightCorner",
                CursorType::BottomSide => "BottomSide",
                CursorType::BottomTee => "BottomTee",
                CursorType::BoxSpiral => "BoxSpiral",
                CursorType::CenterPtr => "CenterPtr",
                CursorType::Circle => "Circle",
                CursorType::Clock => "Clock",
                CursorType::CoffeeMug => "CoffeeMug",
                CursorType::Cross => "Cross",
                CursorType::CrossReverse => "CrossReverse",
                CursorType::Crosshair => "Crosshair",
                CursorType::DiamondCross => "DiamondCross",
                CursorType::Dot => "Dot",
                CursorType::Dotbox => "Dotbox",
                CursorType::DoubleArrow => "DoubleArrow",
                CursorType::DraftLarge => "DraftLarge",
                CursorType::DraftSmall => "DraftSmall",
                CursorType::DrapedBox => "DrapedBox",
                CursorType::Exchange => "Exchange",
                CursorType::Fleur => "Fleur",
                CursorType::Gobbler => "Gobbler",
                CursorType::Gumby => "Gumby",
                CursorType::Hand1 => "Hand1",
                CursorType::Hand2 => "Hand2",
                CursorType::Heart => "Heart",
                CursorType::Icon => "Icon",
                CursorType::IronCross => "IronCross",
                CursorType::LeftPtr => "LeftPtr",
                CursorType::LeftSide => "LeftSide",
                CursorType::LeftTee => "LeftTee",
                CursorType::Leftbutton => "Leftbutton",
                CursorType::LlAngle => "LlAngle",
                CursorType::LrAngle => "LrAngle",
                CursorType::Man => "Man",
                CursorType::Middlebutton => "Middlebutton",
                CursorType::Mouse => "Mouse",
                CursorType::Pencil => "Pencil",
                CursorType::Pirate => "Pirate",
                CursorType::Plus => "Plus",
                CursorType::QuestionArrow => "QuestionArrow",
                CursorType::RightPtr => "RightPtr",
                CursorType::RightSide => "RightSide",
                CursorType::RightTee => "RightTee",
                CursorType::Rightbutton => "Rightbutton",
                CursorType::RtlLogo => "RtlLogo",
                CursorType::Sailboat => "Sailboat",
                CursorType::SbDownArrow => "SbDownArrow",
                CursorType::SbHDoubleArrow => "SbHDoubleArrow",
                CursorType::SbLeftArrow => "SbLeftArrow",
                CursorType::SbRightArrow => "SbRightArrow",
                CursorType::SbUpArrow => "SbUpArrow",
                CursorType::SbVDoubleArrow => "SbVDoubleArrow",
                CursorType::Shuttle => "Shuttle",
                CursorType::Sizing => "Sizing",
                CursorType::Spider => "Spider",
                CursorType::Spraycan => "Spraycan",
                CursorType::Star => "Star",
                CursorType::Target => "Target",
                CursorType::Tcross => "Tcross",
                CursorType::TopLeftArrow => "TopLeftArrow",
                CursorType::TopLeftCorner => "TopLeftCorner",
                CursorType::TopRightCorner => "TopRightCorner",
                CursorType::TopSide => "TopSide",
                CursorType::TopTee => "TopTee",
                CursorType::Trek => "Trek",
                CursorType::UlAngle => "UlAngle",
                CursorType::Umbrella => "Umbrella",
                CursorType::UrAngle => "UrAngle",
                CursorType::Watch => "Watch",
                CursorType::Xterm => "Xterm",
                CursorType::LastCursor => "LastCursor",
                CursorType::BlankCursor => "BlankCursor",
                CursorType::CursorIsPixmap => "CursorIsPixmap",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for CursorType {
    type GlibType = gdk_sys::GdkCursorType;

    fn to_glib(&self) -> gdk_sys::GdkCursorType {
        match *self {
            CursorType::XCursor => gdk_sys::GDK_X_CURSOR,
            CursorType::Arrow => gdk_sys::GDK_ARROW,
            CursorType::BasedArrowDown => gdk_sys::GDK_BASED_ARROW_DOWN,
            CursorType::BasedArrowUp => gdk_sys::GDK_BASED_ARROW_UP,
            CursorType::Boat => gdk_sys::GDK_BOAT,
            CursorType::Bogosity => gdk_sys::GDK_BOGOSITY,
            CursorType::BottomLeftCorner => gdk_sys::GDK_BOTTOM_LEFT_CORNER,
            CursorType::BottomRightCorner => gdk_sys::GDK_BOTTOM_RIGHT_CORNER,
            CursorType::BottomSide => gdk_sys::GDK_BOTTOM_SIDE,
            CursorType::BottomTee => gdk_sys::GDK_BOTTOM_TEE,
            CursorType::BoxSpiral => gdk_sys::GDK_BOX_SPIRAL,
            CursorType::CenterPtr => gdk_sys::GDK_CENTER_PTR,
            CursorType::Circle => gdk_sys::GDK_CIRCLE,
            CursorType::Clock => gdk_sys::GDK_CLOCK,
            CursorType::CoffeeMug => gdk_sys::GDK_COFFEE_MUG,
            CursorType::Cross => gdk_sys::GDK_CROSS,
            CursorType::CrossReverse => gdk_sys::GDK_CROSS_REVERSE,
            CursorType::Crosshair => gdk_sys::GDK_CROSSHAIR,
            CursorType::DiamondCross => gdk_sys::GDK_DIAMOND_CROSS,
            CursorType::Dot => gdk_sys::GDK_DOT,
            CursorType::Dotbox => gdk_sys::GDK_DOTBOX,
            CursorType::DoubleArrow => gdk_sys::GDK_DOUBLE_ARROW,
            CursorType::DraftLarge => gdk_sys::GDK_DRAFT_LARGE,
            CursorType::DraftSmall => gdk_sys::GDK_DRAFT_SMALL,
            CursorType::DrapedBox => gdk_sys::GDK_DRAPED_BOX,
            CursorType::Exchange => gdk_sys::GDK_EXCHANGE,
            CursorType::Fleur => gdk_sys::GDK_FLEUR,
            CursorType::Gobbler => gdk_sys::GDK_GOBBLER,
            CursorType::Gumby => gdk_sys::GDK_GUMBY,
            CursorType::Hand1 => gdk_sys::GDK_HAND1,
            CursorType::Hand2 => gdk_sys::GDK_HAND2,
            CursorType::Heart => gdk_sys::GDK_HEART,
            CursorType::Icon => gdk_sys::GDK_ICON,
            CursorType::IronCross => gdk_sys::GDK_IRON_CROSS,
            CursorType::LeftPtr => gdk_sys::GDK_LEFT_PTR,
            CursorType::LeftSide => gdk_sys::GDK_LEFT_SIDE,
            CursorType::LeftTee => gdk_sys::GDK_LEFT_TEE,
            CursorType::Leftbutton => gdk_sys::GDK_LEFTBUTTON,
            CursorType::LlAngle => gdk_sys::GDK_LL_ANGLE,
            CursorType::LrAngle => gdk_sys::GDK_LR_ANGLE,
            CursorType::Man => gdk_sys::GDK_MAN,
            CursorType::Middlebutton => gdk_sys::GDK_MIDDLEBUTTON,
            CursorType::Mouse => gdk_sys::GDK_MOUSE,
            CursorType::Pencil => gdk_sys::GDK_PENCIL,
            CursorType::Pirate => gdk_sys::GDK_PIRATE,
            CursorType::Plus => gdk_sys::GDK_PLUS,
            CursorType::QuestionArrow => gdk_sys::GDK_QUESTION_ARROW,
            CursorType::RightPtr => gdk_sys::GDK_RIGHT_PTR,
            CursorType::RightSide => gdk_sys::GDK_RIGHT_SIDE,
            CursorType::RightTee => gdk_sys::GDK_RIGHT_TEE,
            CursorType::Rightbutton => gdk_sys::GDK_RIGHTBUTTON,
            CursorType::RtlLogo => gdk_sys::GDK_RTL_LOGO,
            CursorType::Sailboat => gdk_sys::GDK_SAILBOAT,
            CursorType::SbDownArrow => gdk_sys::GDK_SB_DOWN_ARROW,
            CursorType::SbHDoubleArrow => gdk_sys::GDK_SB_H_DOUBLE_ARROW,
            CursorType::SbLeftArrow => gdk_sys::GDK_SB_LEFT_ARROW,
            CursorType::SbRightArrow => gdk_sys::GDK_SB_RIGHT_ARROW,
            CursorType::SbUpArrow => gdk_sys::GDK_SB_UP_ARROW,
            CursorType::SbVDoubleArrow => gdk_sys::GDK_SB_V_DOUBLE_ARROW,
            CursorType::Shuttle => gdk_sys::GDK_SHUTTLE,
            CursorType::Sizing => gdk_sys::GDK_SIZING,
            CursorType::Spider => gdk_sys::GDK_SPIDER,
            CursorType::Spraycan => gdk_sys::GDK_SPRAYCAN,
            CursorType::Star => gdk_sys::GDK_STAR,
            CursorType::Target => gdk_sys::GDK_TARGET,
            CursorType::Tcross => gdk_sys::GDK_TCROSS,
            CursorType::TopLeftArrow => gdk_sys::GDK_TOP_LEFT_ARROW,
            CursorType::TopLeftCorner => gdk_sys::GDK_TOP_LEFT_CORNER,
            CursorType::TopRightCorner => gdk_sys::GDK_TOP_RIGHT_CORNER,
            CursorType::TopSide => gdk_sys::GDK_TOP_SIDE,
            CursorType::TopTee => gdk_sys::GDK_TOP_TEE,
            CursorType::Trek => gdk_sys::GDK_TREK,
            CursorType::UlAngle => gdk_sys::GDK_UL_ANGLE,
            CursorType::Umbrella => gdk_sys::GDK_UMBRELLA,
            CursorType::UrAngle => gdk_sys::GDK_UR_ANGLE,
            CursorType::Watch => gdk_sys::GDK_WATCH,
            CursorType::Xterm => gdk_sys::GDK_XTERM,
            CursorType::LastCursor => gdk_sys::GDK_LAST_CURSOR,
            CursorType::BlankCursor => gdk_sys::GDK_BLANK_CURSOR,
            CursorType::CursorIsPixmap => gdk_sys::GDK_CURSOR_IS_PIXMAP,
            CursorType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkCursorType> for CursorType {
    fn from_glib(value: gdk_sys::GdkCursorType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => CursorType::XCursor,
            2 => CursorType::Arrow,
            4 => CursorType::BasedArrowDown,
            6 => CursorType::BasedArrowUp,
            8 => CursorType::Boat,
            10 => CursorType::Bogosity,
            12 => CursorType::BottomLeftCorner,
            14 => CursorType::BottomRightCorner,
            16 => CursorType::BottomSide,
            18 => CursorType::BottomTee,
            20 => CursorType::BoxSpiral,
            22 => CursorType::CenterPtr,
            24 => CursorType::Circle,
            26 => CursorType::Clock,
            28 => CursorType::CoffeeMug,
            30 => CursorType::Cross,
            32 => CursorType::CrossReverse,
            34 => CursorType::Crosshair,
            36 => CursorType::DiamondCross,
            38 => CursorType::Dot,
            40 => CursorType::Dotbox,
            42 => CursorType::DoubleArrow,
            44 => CursorType::DraftLarge,
            46 => CursorType::DraftSmall,
            48 => CursorType::DrapedBox,
            50 => CursorType::Exchange,
            52 => CursorType::Fleur,
            54 => CursorType::Gobbler,
            56 => CursorType::Gumby,
            58 => CursorType::Hand1,
            60 => CursorType::Hand2,
            62 => CursorType::Heart,
            64 => CursorType::Icon,
            66 => CursorType::IronCross,
            68 => CursorType::LeftPtr,
            70 => CursorType::LeftSide,
            72 => CursorType::LeftTee,
            74 => CursorType::Leftbutton,
            76 => CursorType::LlAngle,
            78 => CursorType::LrAngle,
            80 => CursorType::Man,
            82 => CursorType::Middlebutton,
            84 => CursorType::Mouse,
            86 => CursorType::Pencil,
            88 => CursorType::Pirate,
            90 => CursorType::Plus,
            92 => CursorType::QuestionArrow,
            94 => CursorType::RightPtr,
            96 => CursorType::RightSide,
            98 => CursorType::RightTee,
            100 => CursorType::Rightbutton,
            102 => CursorType::RtlLogo,
            104 => CursorType::Sailboat,
            106 => CursorType::SbDownArrow,
            108 => CursorType::SbHDoubleArrow,
            110 => CursorType::SbLeftArrow,
            112 => CursorType::SbRightArrow,
            114 => CursorType::SbUpArrow,
            116 => CursorType::SbVDoubleArrow,
            118 => CursorType::Shuttle,
            120 => CursorType::Sizing,
            122 => CursorType::Spider,
            124 => CursorType::Spraycan,
            126 => CursorType::Star,
            128 => CursorType::Target,
            130 => CursorType::Tcross,
            132 => CursorType::TopLeftArrow,
            134 => CursorType::TopLeftCorner,
            136 => CursorType::TopRightCorner,
            138 => CursorType::TopSide,
            140 => CursorType::TopTee,
            142 => CursorType::Trek,
            144 => CursorType::UlAngle,
            146 => CursorType::Umbrella,
            148 => CursorType::UrAngle,
            150 => CursorType::Watch,
            152 => CursorType::Xterm,
            153 => CursorType::LastCursor,
            -2 => CursorType::BlankCursor,
            -1 => CursorType::CursorIsPixmap,
            value => CursorType::__Unknown(value),
        }
    }
}

impl StaticType for CursorType {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_cursor_type_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for CursorType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for CursorType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for CursorType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// A pad feature.
#[cfg(any(feature = "v3_22", feature = "dox"))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum DevicePadFeature {
    /// a button
    Button,
    /// a ring-shaped interactive area
    Ring,
    /// a straight interactive area
    ///
    /// Feature: `v3_22`
    ///
    Strip,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl fmt::Display for DevicePadFeature {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "DevicePadFeature::{}",
            match *self {
                DevicePadFeature::Button => "Button",
                DevicePadFeature::Ring => "Ring",
                DevicePadFeature::Strip => "Strip",
                _ => "Unknown",
            }
        )
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for DevicePadFeature {
    type GlibType = gdk_sys::GdkDevicePadFeature;

    fn to_glib(&self) -> gdk_sys::GdkDevicePadFeature {
        match *self {
            DevicePadFeature::Button => gdk_sys::GDK_DEVICE_PAD_FEATURE_BUTTON,
            DevicePadFeature::Ring => gdk_sys::GDK_DEVICE_PAD_FEATURE_RING,
            DevicePadFeature::Strip => gdk_sys::GDK_DEVICE_PAD_FEATURE_STRIP,
            DevicePadFeature::__Unknown(value) => value,
        }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkDevicePadFeature> for DevicePadFeature {
    fn from_glib(value: gdk_sys::GdkDevicePadFeature) -> Self {
        skip_assert_initialized!();
        match value {
            0 => DevicePadFeature::Button,
            1 => DevicePadFeature::Ring,
            2 => DevicePadFeature::Strip,
            value => DevicePadFeature::__Unknown(value),
        }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl StaticType for DevicePadFeature {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_device_pad_feature_get_type()) }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValueOptional<'a> for DevicePadFeature {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValue<'a> for DevicePadFeature {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl SetValue for DevicePadFeature {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Indicates the specific type of tool being used being a tablet. Such as an
/// airbrush, pencil, etc.
#[cfg(any(feature = "v3_22", feature = "dox"))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum DeviceToolType {
    /// Tool is of an unknown type.
    Unknown,
    /// Tool is a standard tablet stylus.
    Pen,
    /// Tool is standard tablet eraser.
    Eraser,
    /// Tool is a brush stylus.
    Brush,
    /// Tool is a pencil stylus.
    Pencil,
    /// Tool is an airbrush stylus.
    Airbrush,
    /// Tool is a mouse.
    Mouse,
    /// Tool is a lens cursor.
    ///
    /// Feature: `v3_22`
    ///
    Lens,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl fmt::Display for DeviceToolType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "DeviceToolType::{}",
            match *self {
                DeviceToolType::Unknown => "Unknown",
                DeviceToolType::Pen => "Pen",
                DeviceToolType::Eraser => "Eraser",
                DeviceToolType::Brush => "Brush",
                DeviceToolType::Pencil => "Pencil",
                DeviceToolType::Airbrush => "Airbrush",
                DeviceToolType::Mouse => "Mouse",
                DeviceToolType::Lens => "Lens",
                _ => "Unknown",
            }
        )
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for DeviceToolType {
    type GlibType = gdk_sys::GdkDeviceToolType;

    fn to_glib(&self) -> gdk_sys::GdkDeviceToolType {
        match *self {
            DeviceToolType::Unknown => gdk_sys::GDK_DEVICE_TOOL_TYPE_UNKNOWN,
            DeviceToolType::Pen => gdk_sys::GDK_DEVICE_TOOL_TYPE_PEN,
            DeviceToolType::Eraser => gdk_sys::GDK_DEVICE_TOOL_TYPE_ERASER,
            DeviceToolType::Brush => gdk_sys::GDK_DEVICE_TOOL_TYPE_BRUSH,
            DeviceToolType::Pencil => gdk_sys::GDK_DEVICE_TOOL_TYPE_PENCIL,
            DeviceToolType::Airbrush => gdk_sys::GDK_DEVICE_TOOL_TYPE_AIRBRUSH,
            DeviceToolType::Mouse => gdk_sys::GDK_DEVICE_TOOL_TYPE_MOUSE,
            DeviceToolType::Lens => gdk_sys::GDK_DEVICE_TOOL_TYPE_LENS,
            DeviceToolType::__Unknown(value) => value,
        }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkDeviceToolType> for DeviceToolType {
    fn from_glib(value: gdk_sys::GdkDeviceToolType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => DeviceToolType::Unknown,
            1 => DeviceToolType::Pen,
            2 => DeviceToolType::Eraser,
            3 => DeviceToolType::Brush,
            4 => DeviceToolType::Pencil,
            5 => DeviceToolType::Airbrush,
            6 => DeviceToolType::Mouse,
            7 => DeviceToolType::Lens,
            value => DeviceToolType::__Unknown(value),
        }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl StaticType for DeviceToolType {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_device_tool_type_get_type()) }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValueOptional<'a> for DeviceToolType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValue<'a> for DeviceToolType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl SetValue for DeviceToolType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Indicates the device type. See [above][`DeviceManager`.description]
/// for more information about the meaning of these device types.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum DeviceType {
    /// Device is a master (or virtual) device. There will
    ///  be an associated focus indicator on the screen.
    Master,
    /// Device is a slave (or physical) device.
    Slave,
    /// Device is a physical device, currently not attached to
    ///  any virtual device.
    Floating,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for DeviceType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "DeviceType::{}",
            match *self {
                DeviceType::Master => "Master",
                DeviceType::Slave => "Slave",
                DeviceType::Floating => "Floating",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for DeviceType {
    type GlibType = gdk_sys::GdkDeviceType;

    fn to_glib(&self) -> gdk_sys::GdkDeviceType {
        match *self {
            DeviceType::Master => gdk_sys::GDK_DEVICE_TYPE_MASTER,
            DeviceType::Slave => gdk_sys::GDK_DEVICE_TYPE_SLAVE,
            DeviceType::Floating => gdk_sys::GDK_DEVICE_TYPE_FLOATING,
            DeviceType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkDeviceType> for DeviceType {
    fn from_glib(value: gdk_sys::GdkDeviceType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => DeviceType::Master,
            1 => DeviceType::Slave,
            2 => DeviceType::Floating,
            value => DeviceType::__Unknown(value),
        }
    }
}

impl StaticType for DeviceType {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_device_type_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for DeviceType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for DeviceType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for DeviceType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Used in `DragContext` to the reason of a cancelled DND operation.
#[cfg(any(feature = "v3_20", feature = "dox"))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum DragCancelReason {
    /// There is no suitable drop target.
    NoTarget,
    /// Drag cancelled by the user
    UserCancelled,
    /// Unspecified error.
    ///
    /// Feature: `v3_20`
    ///
    Error,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl fmt::Display for DragCancelReason {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "DragCancelReason::{}",
            match *self {
                DragCancelReason::NoTarget => "NoTarget",
                DragCancelReason::UserCancelled => "UserCancelled",
                DragCancelReason::Error => "Error",
                _ => "Unknown",
            }
        )
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for DragCancelReason {
    type GlibType = gdk_sys::GdkDragCancelReason;

    fn to_glib(&self) -> gdk_sys::GdkDragCancelReason {
        match *self {
            DragCancelReason::NoTarget => gdk_sys::GDK_DRAG_CANCEL_NO_TARGET,
            DragCancelReason::UserCancelled => gdk_sys::GDK_DRAG_CANCEL_USER_CANCELLED,
            DragCancelReason::Error => gdk_sys::GDK_DRAG_CANCEL_ERROR,
            DragCancelReason::__Unknown(value) => value,
        }
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkDragCancelReason> for DragCancelReason {
    fn from_glib(value: gdk_sys::GdkDragCancelReason) -> Self {
        skip_assert_initialized!();
        match value {
            0 => DragCancelReason::NoTarget,
            1 => DragCancelReason::UserCancelled,
            2 => DragCancelReason::Error,
            value => DragCancelReason::__Unknown(value),
        }
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl StaticType for DragCancelReason {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_drag_cancel_reason_get_type()) }
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl<'a> FromValueOptional<'a> for DragCancelReason {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl<'a> FromValue<'a> for DragCancelReason {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_20", feature = "dox"))]
impl SetValue for DragCancelReason {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Used in `DragContext` to indicate the protocol according to
/// which DND is done.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum DragProtocol {
    /// no protocol.
    None,
    /// The Motif DND protocol. No longer supported
    Motif,
    /// The Xdnd protocol.
    Xdnd,
    /// An extension to the Xdnd protocol for
    ///  unclaimed root window drops.
    Rootwin,
    /// The simple WM_DROPFILES protocol.
    Win32Dropfiles,
    /// The complex OLE2 DND protocol (not implemented).
    Ole2,
    /// Intra-application DND.
    Local,
    /// Wayland DND protocol.
    Wayland,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for DragProtocol {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "DragProtocol::{}",
            match *self {
                DragProtocol::None => "None",
                DragProtocol::Motif => "Motif",
                DragProtocol::Xdnd => "Xdnd",
                DragProtocol::Rootwin => "Rootwin",
                DragProtocol::Win32Dropfiles => "Win32Dropfiles",
                DragProtocol::Ole2 => "Ole2",
                DragProtocol::Local => "Local",
                DragProtocol::Wayland => "Wayland",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for DragProtocol {
    type GlibType = gdk_sys::GdkDragProtocol;

    fn to_glib(&self) -> gdk_sys::GdkDragProtocol {
        match *self {
            DragProtocol::None => gdk_sys::GDK_DRAG_PROTO_NONE,
            DragProtocol::Motif => gdk_sys::GDK_DRAG_PROTO_MOTIF,
            DragProtocol::Xdnd => gdk_sys::GDK_DRAG_PROTO_XDND,
            DragProtocol::Rootwin => gdk_sys::GDK_DRAG_PROTO_ROOTWIN,
            DragProtocol::Win32Dropfiles => gdk_sys::GDK_DRAG_PROTO_WIN32_DROPFILES,
            DragProtocol::Ole2 => gdk_sys::GDK_DRAG_PROTO_OLE2,
            DragProtocol::Local => gdk_sys::GDK_DRAG_PROTO_LOCAL,
            DragProtocol::Wayland => gdk_sys::GDK_DRAG_PROTO_WAYLAND,
            DragProtocol::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkDragProtocol> for DragProtocol {
    fn from_glib(value: gdk_sys::GdkDragProtocol) -> Self {
        skip_assert_initialized!();
        match value {
            0 => DragProtocol::None,
            1 => DragProtocol::Motif,
            2 => DragProtocol::Xdnd,
            3 => DragProtocol::Rootwin,
            4 => DragProtocol::Win32Dropfiles,
            5 => DragProtocol::Ole2,
            6 => DragProtocol::Local,
            7 => DragProtocol::Wayland,
            value => DragProtocol::__Unknown(value),
        }
    }
}

impl StaticType for DragProtocol {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_drag_protocol_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for DragProtocol {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for DragProtocol {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for DragProtocol {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies the type of the event.
///
/// Do not confuse these events with the signals that GTK+ widgets emit.
/// Although many of these events result in corresponding signals being emitted,
/// the events are often transformed or filtered along the way.
///
/// In some language bindings, the values `EventType::2buttonPress` and
/// `EventType::3buttonPress` would translate into something syntactically
/// invalid (eg `Gdk.EventType.2ButtonPress`, where a
/// symbol is not allowed to start with a number). In that case, the
/// aliases `EventType::DoubleButtonPress` and `EventType::TripleButtonPress` can
/// be used instead.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum EventType {
    /// a special code to indicate a null event.
    Nothing,
    /// the window manager has requested that the toplevel window be
    ///  hidden or destroyed, usually when the user clicks on a special icon in the
    ///  title bar.
    Delete,
    /// the window has been destroyed.
    Destroy,
    /// all or part of the window has become visible and needs to be
    ///  redrawn.
    Expose,
    /// the pointer (usually a mouse) has moved.
    MotionNotify,
    /// a mouse button has been pressed.
    ButtonPress,
    /// alias for `EventType::2buttonPress`, added in 3.6.
    DoubleButtonPress,
    /// alias for `EventType::3buttonPress`, added in 3.6.
    TripleButtonPress,
    /// a mouse button has been released.
    ButtonRelease,
    /// a key has been pressed.
    KeyPress,
    /// a key has been released.
    KeyRelease,
    /// the pointer has entered the window.
    EnterNotify,
    /// the pointer has left the window.
    LeaveNotify,
    /// the keyboard focus has entered or left the window.
    FocusChange,
    /// the size, position or stacking order of the window has changed.
    ///  Note that GTK+ discards these events for `WindowType::Child` windows.
    Configure,
    /// the window has been mapped.
    Map,
    /// the window has been unmapped.
    Unmap,
    /// a property on the window has been changed or deleted.
    PropertyNotify,
    /// the application has lost ownership of a selection.
    SelectionClear,
    /// another application has requested a selection.
    SelectionRequest,
    /// a selection has been received.
    SelectionNotify,
    /// an input device has moved into contact with a sensing
    ///  surface (e.g. a touchscreen or graphics tablet).
    ProximityIn,
    /// an input device has moved out of contact with a sensing
    ///  surface.
    ProximityOut,
    /// the mouse has entered the window while a drag is in progress.
    DragEnter,
    /// the mouse has left the window while a drag is in progress.
    DragLeave,
    /// the mouse has moved in the window while a drag is in
    ///  progress.
    DragMotion,
    /// the status of the drag operation initiated by the window
    ///  has changed.
    DragStatus,
    /// a drop operation onto the window has started.
    DropStart,
    /// the drop operation initiated by the window has completed.
    DropFinished,
    /// a message has been received from another application.
    ClientEvent,
    /// the window visibility status has changed.
    VisibilityNotify,
    /// the scroll wheel was turned
    Scroll,
    /// the state of a window has changed. See `WindowState`
    ///  for the possible window states
    WindowState,
    /// a setting has been modified.
    Setting,
    /// the owner of a selection has changed. This event type
    ///  was added in 2.6
    OwnerChange,
    /// a pointer or keyboard grab was broken. This event type
    ///  was added in 2.8.
    GrabBroken,
    /// the content of the window has been changed. This event type
    ///  was added in 2.14.
    Damage,
    /// A new touch event sequence has just started. This event
    ///  type was added in 3.4.
    TouchBegin,
    /// A touch event sequence has been updated. This event type
    ///  was added in 3.4.
    TouchUpdate,
    /// A touch event sequence has finished. This event type
    ///  was added in 3.4.
    TouchEnd,
    /// A touch event sequence has been canceled. This event type
    ///  was added in 3.4.
    TouchCancel,
    /// A touchpad swipe gesture event, the current state
    ///  is determined by its phase field. This event type was added in 3.18.
    #[cfg(any(feature = "v3_18", feature = "dox"))]
    TouchpadSwipe,
    /// A touchpad pinch gesture event, the current state
    ///  is determined by its phase field. This event type was added in 3.18.
    #[cfg(any(feature = "v3_18", feature = "dox"))]
    TouchpadPinch,
    /// A tablet pad button press event. This event type
    ///  was added in 3.22.
    PadButtonPress,
    /// A tablet pad button release event. This event type
    ///  was added in 3.22.
    PadButtonRelease,
    /// A tablet pad axis event from a "ring". This event type was
    ///  added in 3.22.
    PadRing,
    /// A tablet pad axis event from a "strip". This event type was
    ///  added in 3.22.
    PadStrip,
    /// A tablet pad group mode change. This event type was
    ///  added in 3.22.
    PadGroupMode,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for EventType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "EventType::{}",
            match *self {
                EventType::Nothing => "Nothing",
                EventType::Delete => "Delete",
                EventType::Destroy => "Destroy",
                EventType::Expose => "Expose",
                EventType::MotionNotify => "MotionNotify",
                EventType::ButtonPress => "ButtonPress",
                EventType::DoubleButtonPress => "DoubleButtonPress",
                EventType::TripleButtonPress => "TripleButtonPress",
                EventType::ButtonRelease => "ButtonRelease",
                EventType::KeyPress => "KeyPress",
                EventType::KeyRelease => "KeyRelease",
                EventType::EnterNotify => "EnterNotify",
                EventType::LeaveNotify => "LeaveNotify",
                EventType::FocusChange => "FocusChange",
                EventType::Configure => "Configure",
                EventType::Map => "Map",
                EventType::Unmap => "Unmap",
                EventType::PropertyNotify => "PropertyNotify",
                EventType::SelectionClear => "SelectionClear",
                EventType::SelectionRequest => "SelectionRequest",
                EventType::SelectionNotify => "SelectionNotify",
                EventType::ProximityIn => "ProximityIn",
                EventType::ProximityOut => "ProximityOut",
                EventType::DragEnter => "DragEnter",
                EventType::DragLeave => "DragLeave",
                EventType::DragMotion => "DragMotion",
                EventType::DragStatus => "DragStatus",
                EventType::DropStart => "DropStart",
                EventType::DropFinished => "DropFinished",
                EventType::ClientEvent => "ClientEvent",
                EventType::VisibilityNotify => "VisibilityNotify",
                EventType::Scroll => "Scroll",
                EventType::WindowState => "WindowState",
                EventType::Setting => "Setting",
                EventType::OwnerChange => "OwnerChange",
                EventType::GrabBroken => "GrabBroken",
                EventType::Damage => "Damage",
                EventType::TouchBegin => "TouchBegin",
                EventType::TouchUpdate => "TouchUpdate",
                EventType::TouchEnd => "TouchEnd",
                EventType::TouchCancel => "TouchCancel",
                #[cfg(any(feature = "v3_18", feature = "dox"))]
                EventType::TouchpadSwipe => "TouchpadSwipe",
                #[cfg(any(feature = "v3_18", feature = "dox"))]
                EventType::TouchpadPinch => "TouchpadPinch",
                EventType::PadButtonPress => "PadButtonPress",
                EventType::PadButtonRelease => "PadButtonRelease",
                EventType::PadRing => "PadRing",
                EventType::PadStrip => "PadStrip",
                EventType::PadGroupMode => "PadGroupMode",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for EventType {
    type GlibType = gdk_sys::GdkEventType;

    fn to_glib(&self) -> gdk_sys::GdkEventType {
        match *self {
            EventType::Nothing => gdk_sys::GDK_NOTHING,
            EventType::Delete => gdk_sys::GDK_DELETE,
            EventType::Destroy => gdk_sys::GDK_DESTROY,
            EventType::Expose => gdk_sys::GDK_EXPOSE,
            EventType::MotionNotify => gdk_sys::GDK_MOTION_NOTIFY,
            EventType::ButtonPress => gdk_sys::GDK_BUTTON_PRESS,
            EventType::DoubleButtonPress => gdk_sys::GDK_DOUBLE_BUTTON_PRESS,
            EventType::TripleButtonPress => gdk_sys::GDK_TRIPLE_BUTTON_PRESS,
            EventType::ButtonRelease => gdk_sys::GDK_BUTTON_RELEASE,
            EventType::KeyPress => gdk_sys::GDK_KEY_PRESS,
            EventType::KeyRelease => gdk_sys::GDK_KEY_RELEASE,
            EventType::EnterNotify => gdk_sys::GDK_ENTER_NOTIFY,
            EventType::LeaveNotify => gdk_sys::GDK_LEAVE_NOTIFY,
            EventType::FocusChange => gdk_sys::GDK_FOCUS_CHANGE,
            EventType::Configure => gdk_sys::GDK_CONFIGURE,
            EventType::Map => gdk_sys::GDK_MAP,
            EventType::Unmap => gdk_sys::GDK_UNMAP,
            EventType::PropertyNotify => gdk_sys::GDK_PROPERTY_NOTIFY,
            EventType::SelectionClear => gdk_sys::GDK_SELECTION_CLEAR,
            EventType::SelectionRequest => gdk_sys::GDK_SELECTION_REQUEST,
            EventType::SelectionNotify => gdk_sys::GDK_SELECTION_NOTIFY,
            EventType::ProximityIn => gdk_sys::GDK_PROXIMITY_IN,
            EventType::ProximityOut => gdk_sys::GDK_PROXIMITY_OUT,
            EventType::DragEnter => gdk_sys::GDK_DRAG_ENTER,
            EventType::DragLeave => gdk_sys::GDK_DRAG_LEAVE,
            EventType::DragMotion => gdk_sys::GDK_DRAG_MOTION,
            EventType::DragStatus => gdk_sys::GDK_DRAG_STATUS,
            EventType::DropStart => gdk_sys::GDK_DROP_START,
            EventType::DropFinished => gdk_sys::GDK_DROP_FINISHED,
            EventType::ClientEvent => gdk_sys::GDK_CLIENT_EVENT,
            EventType::VisibilityNotify => gdk_sys::GDK_VISIBILITY_NOTIFY,
            EventType::Scroll => gdk_sys::GDK_SCROLL,
            EventType::WindowState => gdk_sys::GDK_WINDOW_STATE,
            EventType::Setting => gdk_sys::GDK_SETTING,
            EventType::OwnerChange => gdk_sys::GDK_OWNER_CHANGE,
            EventType::GrabBroken => gdk_sys::GDK_GRAB_BROKEN,
            EventType::Damage => gdk_sys::GDK_DAMAGE,
            EventType::TouchBegin => gdk_sys::GDK_TOUCH_BEGIN,
            EventType::TouchUpdate => gdk_sys::GDK_TOUCH_UPDATE,
            EventType::TouchEnd => gdk_sys::GDK_TOUCH_END,
            EventType::TouchCancel => gdk_sys::GDK_TOUCH_CANCEL,
            #[cfg(any(feature = "v3_18", feature = "dox"))]
            EventType::TouchpadSwipe => gdk_sys::GDK_TOUCHPAD_SWIPE,
            #[cfg(any(feature = "v3_18", feature = "dox"))]
            EventType::TouchpadPinch => gdk_sys::GDK_TOUCHPAD_PINCH,
            EventType::PadButtonPress => gdk_sys::GDK_PAD_BUTTON_PRESS,
            EventType::PadButtonRelease => gdk_sys::GDK_PAD_BUTTON_RELEASE,
            EventType::PadRing => gdk_sys::GDK_PAD_RING,
            EventType::PadStrip => gdk_sys::GDK_PAD_STRIP,
            EventType::PadGroupMode => gdk_sys::GDK_PAD_GROUP_MODE,
            EventType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkEventType> for EventType {
    fn from_glib(value: gdk_sys::GdkEventType) -> Self {
        skip_assert_initialized!();
        match value {
            -1 => EventType::Nothing,
            0 => EventType::Delete,
            1 => EventType::Destroy,
            2 => EventType::Expose,
            3 => EventType::MotionNotify,
            4 => EventType::ButtonPress,
            5 => EventType::DoubleButtonPress,
            6 => EventType::TripleButtonPress,
            7 => EventType::ButtonRelease,
            8 => EventType::KeyPress,
            9 => EventType::KeyRelease,
            10 => EventType::EnterNotify,
            11 => EventType::LeaveNotify,
            12 => EventType::FocusChange,
            13 => EventType::Configure,
            14 => EventType::Map,
            15 => EventType::Unmap,
            16 => EventType::PropertyNotify,
            17 => EventType::SelectionClear,
            18 => EventType::SelectionRequest,
            19 => EventType::SelectionNotify,
            20 => EventType::ProximityIn,
            21 => EventType::ProximityOut,
            22 => EventType::DragEnter,
            23 => EventType::DragLeave,
            24 => EventType::DragMotion,
            25 => EventType::DragStatus,
            26 => EventType::DropStart,
            27 => EventType::DropFinished,
            28 => EventType::ClientEvent,
            29 => EventType::VisibilityNotify,
            31 => EventType::Scroll,
            32 => EventType::WindowState,
            33 => EventType::Setting,
            34 => EventType::OwnerChange,
            35 => EventType::GrabBroken,
            36 => EventType::Damage,
            37 => EventType::TouchBegin,
            38 => EventType::TouchUpdate,
            39 => EventType::TouchEnd,
            40 => EventType::TouchCancel,
            #[cfg(any(feature = "v3_18", feature = "dox"))]
            41 => EventType::TouchpadSwipe,
            #[cfg(any(feature = "v3_18", feature = "dox"))]
            42 => EventType::TouchpadPinch,
            43 => EventType::PadButtonPress,
            44 => EventType::PadButtonRelease,
            45 => EventType::PadRing,
            46 => EventType::PadStrip,
            47 => EventType::PadGroupMode,
            value => EventType::__Unknown(value),
        }
    }
}

impl StaticType for EventType {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_event_type_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for EventType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for EventType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for EventType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Indicates which monitor (in a multi-head setup) a window should span over
/// when in fullscreen mode.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum FullscreenMode {
    /// Fullscreen on current monitor only.
    CurrentMonitor,
    /// Span across all monitors when fullscreen.
    AllMonitors,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for FullscreenMode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "FullscreenMode::{}",
            match *self {
                FullscreenMode::CurrentMonitor => "CurrentMonitor",
                FullscreenMode::AllMonitors => "AllMonitors",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for FullscreenMode {
    type GlibType = gdk_sys::GdkFullscreenMode;

    fn to_glib(&self) -> gdk_sys::GdkFullscreenMode {
        match *self {
            FullscreenMode::CurrentMonitor => gdk_sys::GDK_FULLSCREEN_ON_CURRENT_MONITOR,
            FullscreenMode::AllMonitors => gdk_sys::GDK_FULLSCREEN_ON_ALL_MONITORS,
            FullscreenMode::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkFullscreenMode> for FullscreenMode {
    fn from_glib(value: gdk_sys::GdkFullscreenMode) -> Self {
        skip_assert_initialized!();
        match value {
            0 => FullscreenMode::CurrentMonitor,
            1 => FullscreenMode::AllMonitors,
            value => FullscreenMode::__Unknown(value),
        }
    }
}

impl StaticType for FullscreenMode {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_fullscreen_mode_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for FullscreenMode {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for FullscreenMode {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for FullscreenMode {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Error enumeration for `GLContext`.
#[cfg(any(feature = "v3_16", feature = "dox"))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum GLError {
    /// OpenGL support is not available
    NotAvailable,
    /// The requested visual format is not supported
    UnsupportedFormat,
    /// The requested profile is not supported
    ///
    /// Feature: `v3_16`
    ///
    UnsupportedProfile,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
impl fmt::Display for GLError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "GLError::{}",
            match *self {
                GLError::NotAvailable => "NotAvailable",
                GLError::UnsupportedFormat => "UnsupportedFormat",
                GLError::UnsupportedProfile => "UnsupportedProfile",
                _ => "Unknown",
            }
        )
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for GLError {
    type GlibType = gdk_sys::GdkGLError;

    fn to_glib(&self) -> gdk_sys::GdkGLError {
        match *self {
            GLError::NotAvailable => gdk_sys::GDK_GL_ERROR_NOT_AVAILABLE,
            GLError::UnsupportedFormat => gdk_sys::GDK_GL_ERROR_UNSUPPORTED_FORMAT,
            GLError::UnsupportedProfile => gdk_sys::GDK_GL_ERROR_UNSUPPORTED_PROFILE,
            GLError::__Unknown(value) => value,
        }
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkGLError> for GLError {
    fn from_glib(value: gdk_sys::GdkGLError) -> Self {
        skip_assert_initialized!();
        match value {
            0 => GLError::NotAvailable,
            1 => GLError::UnsupportedFormat,
            2 => GLError::UnsupportedProfile,
            value => GLError::__Unknown(value),
        }
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
impl ErrorDomain for GLError {
    fn domain() -> Quark {
        skip_assert_initialized!();
        unsafe { from_glib(gdk_sys::gdk_gl_error_quark()) }
    }

    fn code(self) -> i32 {
        self.to_glib()
    }

    fn from(code: i32) -> Option<Self> {
        skip_assert_initialized!();
        match code {
            0 => Some(GLError::NotAvailable),
            1 => Some(GLError::UnsupportedFormat),
            2 => Some(GLError::UnsupportedProfile),
            value => Some(GLError::__Unknown(value)),
        }
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
impl StaticType for GLError {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_gl_error_get_type()) }
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
impl<'a> FromValueOptional<'a> for GLError {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
impl<'a> FromValue<'a> for GLError {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_16", feature = "dox"))]
impl SetValue for GLError {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Defines how device grabs interact with other devices.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum GrabOwnership {
    /// All other devices’ events are allowed.
    None,
    /// Other devices’ events are blocked for the grab window.
    Window,
    /// Other devices’ events are blocked for the whole application.
    Application,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for GrabOwnership {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "GrabOwnership::{}",
            match *self {
                GrabOwnership::None => "None",
                GrabOwnership::Window => "Window",
                GrabOwnership::Application => "Application",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for GrabOwnership {
    type GlibType = gdk_sys::GdkGrabOwnership;

    fn to_glib(&self) -> gdk_sys::GdkGrabOwnership {
        match *self {
            GrabOwnership::None => gdk_sys::GDK_OWNERSHIP_NONE,
            GrabOwnership::Window => gdk_sys::GDK_OWNERSHIP_WINDOW,
            GrabOwnership::Application => gdk_sys::GDK_OWNERSHIP_APPLICATION,
            GrabOwnership::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkGrabOwnership> for GrabOwnership {
    fn from_glib(value: gdk_sys::GdkGrabOwnership) -> Self {
        skip_assert_initialized!();
        match value {
            0 => GrabOwnership::None,
            1 => GrabOwnership::Window,
            2 => GrabOwnership::Application,
            value => GrabOwnership::__Unknown(value),
        }
    }
}

impl StaticType for GrabOwnership {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_grab_ownership_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for GrabOwnership {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for GrabOwnership {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for GrabOwnership {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Returned by `Device::grab`, `gdk_pointer_grab` and `gdk_keyboard_grab` to
/// indicate success or the reason for the failure of the grab attempt.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum GrabStatus {
    /// the resource was successfully grabbed.
    Success,
    /// the resource is actively grabbed by another client.
    AlreadyGrabbed,
    /// the resource was grabbed more recently than the
    ///  specified time.
    InvalidTime,
    /// the grab window or the `confine_to` window are not
    ///  viewable.
    NotViewable,
    /// the resource is frozen by an active grab of another client.
    Frozen,
    /// the grab failed for some other reason. Since 3.16
    Failed,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for GrabStatus {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "GrabStatus::{}",
            match *self {
                GrabStatus::Success => "Success",
                GrabStatus::AlreadyGrabbed => "AlreadyGrabbed",
                GrabStatus::InvalidTime => "InvalidTime",
                GrabStatus::NotViewable => "NotViewable",
                GrabStatus::Frozen => "Frozen",
                GrabStatus::Failed => "Failed",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for GrabStatus {
    type GlibType = gdk_sys::GdkGrabStatus;

    fn to_glib(&self) -> gdk_sys::GdkGrabStatus {
        match *self {
            GrabStatus::Success => gdk_sys::GDK_GRAB_SUCCESS,
            GrabStatus::AlreadyGrabbed => gdk_sys::GDK_GRAB_ALREADY_GRABBED,
            GrabStatus::InvalidTime => gdk_sys::GDK_GRAB_INVALID_TIME,
            GrabStatus::NotViewable => gdk_sys::GDK_GRAB_NOT_VIEWABLE,
            GrabStatus::Frozen => gdk_sys::GDK_GRAB_FROZEN,
            GrabStatus::Failed => gdk_sys::GDK_GRAB_FAILED,
            GrabStatus::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkGrabStatus> for GrabStatus {
    fn from_glib(value: gdk_sys::GdkGrabStatus) -> Self {
        skip_assert_initialized!();
        match value {
            0 => GrabStatus::Success,
            1 => GrabStatus::AlreadyGrabbed,
            2 => GrabStatus::InvalidTime,
            3 => GrabStatus::NotViewable,
            4 => GrabStatus::Frozen,
            5 => GrabStatus::Failed,
            value => GrabStatus::__Unknown(value),
        }
    }
}

impl StaticType for GrabStatus {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_grab_status_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for GrabStatus {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for GrabStatus {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for GrabStatus {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Defines the reference point of a window and the meaning of coordinates
/// passed to `gtk_window_move`. See `gtk_window_move` and the "implementation
/// notes" section of the
/// [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec)
/// specification for more details.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum Gravity {
    /// the reference point is at the top left corner.
    NorthWest,
    /// the reference point is in the middle of the top edge.
    North,
    /// the reference point is at the top right corner.
    NorthEast,
    /// the reference point is at the middle of the left edge.
    West,
    /// the reference point is at the center of the window.
    Center,
    /// the reference point is at the middle of the right edge.
    East,
    /// the reference point is at the lower left corner.
    SouthWest,
    /// the reference point is at the middle of the lower edge.
    South,
    /// the reference point is at the lower right corner.
    SouthEast,
    /// the reference point is at the top left corner of the
    ///  window itself, ignoring window manager decorations.
    Static,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for Gravity {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "Gravity::{}",
            match *self {
                Gravity::NorthWest => "NorthWest",
                Gravity::North => "North",
                Gravity::NorthEast => "NorthEast",
                Gravity::West => "West",
                Gravity::Center => "Center",
                Gravity::East => "East",
                Gravity::SouthWest => "SouthWest",
                Gravity::South => "South",
                Gravity::SouthEast => "SouthEast",
                Gravity::Static => "Static",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for Gravity {
    type GlibType = gdk_sys::GdkGravity;

    fn to_glib(&self) -> gdk_sys::GdkGravity {
        match *self {
            Gravity::NorthWest => gdk_sys::GDK_GRAVITY_NORTH_WEST,
            Gravity::North => gdk_sys::GDK_GRAVITY_NORTH,
            Gravity::NorthEast => gdk_sys::GDK_GRAVITY_NORTH_EAST,
            Gravity::West => gdk_sys::GDK_GRAVITY_WEST,
            Gravity::Center => gdk_sys::GDK_GRAVITY_CENTER,
            Gravity::East => gdk_sys::GDK_GRAVITY_EAST,
            Gravity::SouthWest => gdk_sys::GDK_GRAVITY_SOUTH_WEST,
            Gravity::South => gdk_sys::GDK_GRAVITY_SOUTH,
            Gravity::SouthEast => gdk_sys::GDK_GRAVITY_SOUTH_EAST,
            Gravity::Static => gdk_sys::GDK_GRAVITY_STATIC,
            Gravity::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkGravity> for Gravity {
    fn from_glib(value: gdk_sys::GdkGravity) -> Self {
        skip_assert_initialized!();
        match value {
            1 => Gravity::NorthWest,
            2 => Gravity::North,
            3 => Gravity::NorthEast,
            4 => Gravity::West,
            5 => Gravity::Center,
            6 => Gravity::East,
            7 => Gravity::SouthWest,
            8 => Gravity::South,
            9 => Gravity::SouthEast,
            10 => Gravity::Static,
            value => Gravity::__Unknown(value),
        }
    }
}

impl StaticType for Gravity {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_gravity_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for Gravity {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for Gravity {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for Gravity {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// An enumeration that describes the mode of an input device.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum InputMode {
    /// the device is disabled and will not report any events.
    Disabled,
    /// the device is enabled. The device’s coordinate space
    ///  maps to the entire screen.
    Screen,
    /// the device is enabled. The device’s coordinate space
    ///  is mapped to a single window. The manner in which this window
    ///  is chosen is undefined, but it will typically be the same
    ///  way in which the focus window for key events is determined.
    Window,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for InputMode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "InputMode::{}",
            match *self {
                InputMode::Disabled => "Disabled",
                InputMode::Screen => "Screen",
                InputMode::Window => "Window",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for InputMode {
    type GlibType = gdk_sys::GdkInputMode;

    fn to_glib(&self) -> gdk_sys::GdkInputMode {
        match *self {
            InputMode::Disabled => gdk_sys::GDK_MODE_DISABLED,
            InputMode::Screen => gdk_sys::GDK_MODE_SCREEN,
            InputMode::Window => gdk_sys::GDK_MODE_WINDOW,
            InputMode::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkInputMode> for InputMode {
    fn from_glib(value: gdk_sys::GdkInputMode) -> Self {
        skip_assert_initialized!();
        match value {
            0 => InputMode::Disabled,
            1 => InputMode::Screen,
            2 => InputMode::Window,
            value => InputMode::__Unknown(value),
        }
    }
}

impl StaticType for InputMode {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_input_mode_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for InputMode {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for InputMode {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for InputMode {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// An enumeration describing the type of an input device in general terms.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum InputSource {
    /// the device is a mouse. (This will be reported for the core
    ///  pointer, even if it is something else, such as a trackball.)
    Mouse,
    /// the device is a stylus of a graphics tablet or similar device.
    Pen,
    /// the device is an eraser. Typically, this would be the other end
    ///  of a stylus on a graphics tablet.
    Eraser,
    /// the device is a graphics tablet “puck” or similar device.
    Cursor,
    /// the device is a keyboard.
    Keyboard,
    /// the device is a direct-input touch device, such
    ///  as a touchscreen or tablet. This device type has been added in 3.4.
    Touchscreen,
    /// the device is an indirect touch device, such
    ///  as a touchpad. This device type has been added in 3.4.
    Touchpad,
    /// the device is a trackpoint. This device type has been
    ///  added in 3.22
    Trackpoint,
    /// the device is a "pad", a collection of buttons,
    ///  rings and strips found in drawing tablets. This device type has been
    ///  added in 3.22.
    TabletPad,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for InputSource {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "InputSource::{}",
            match *self {
                InputSource::Mouse => "Mouse",
                InputSource::Pen => "Pen",
                InputSource::Eraser => "Eraser",
                InputSource::Cursor => "Cursor",
                InputSource::Keyboard => "Keyboard",
                InputSource::Touchscreen => "Touchscreen",
                InputSource::Touchpad => "Touchpad",
                InputSource::Trackpoint => "Trackpoint",
                InputSource::TabletPad => "TabletPad",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for InputSource {
    type GlibType = gdk_sys::GdkInputSource;

    fn to_glib(&self) -> gdk_sys::GdkInputSource {
        match *self {
            InputSource::Mouse => gdk_sys::GDK_SOURCE_MOUSE,
            InputSource::Pen => gdk_sys::GDK_SOURCE_PEN,
            InputSource::Eraser => gdk_sys::GDK_SOURCE_ERASER,
            InputSource::Cursor => gdk_sys::GDK_SOURCE_CURSOR,
            InputSource::Keyboard => gdk_sys::GDK_SOURCE_KEYBOARD,
            InputSource::Touchscreen => gdk_sys::GDK_SOURCE_TOUCHSCREEN,
            InputSource::Touchpad => gdk_sys::GDK_SOURCE_TOUCHPAD,
            InputSource::Trackpoint => gdk_sys::GDK_SOURCE_TRACKPOINT,
            InputSource::TabletPad => gdk_sys::GDK_SOURCE_TABLET_PAD,
            InputSource::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkInputSource> for InputSource {
    fn from_glib(value: gdk_sys::GdkInputSource) -> Self {
        skip_assert_initialized!();
        match value {
            0 => InputSource::Mouse,
            1 => InputSource::Pen,
            2 => InputSource::Eraser,
            3 => InputSource::Cursor,
            4 => InputSource::Keyboard,
            5 => InputSource::Touchscreen,
            6 => InputSource::Touchpad,
            7 => InputSource::Trackpoint,
            8 => InputSource::TabletPad,
            value => InputSource::__Unknown(value),
        }
    }
}

impl StaticType for InputSource {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_input_source_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for InputSource {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for InputSource {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for InputSource {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// This enum is used with `Keymap::get_modifier_mask`
/// in order to determine what modifiers the
/// currently used windowing system backend uses for particular
/// purposes. For example, on X11/Windows, the Control key is used for
/// invoking menu shortcuts (accelerators), whereas on Apple computers
/// it’s the Command key (which correspond to `ModifierType::ControlMask` and
/// `ModifierType::Mod2Mask`, respectively).
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum ModifierIntent {
    /// the primary modifier used to invoke
    ///  menu accelerators.
    PrimaryAccelerator,
    /// the modifier used to invoke context menus.
    ///  Note that mouse button 3 always triggers context menus. When this modifier
    ///  is not 0, it additionally triggers context menus when used with mouse button 1.
    ContextMenu,
    /// the modifier used to extend selections
    ///  using `modifier`-click or `modifier`-cursor-key
    ExtendSelection,
    /// the modifier used to modify selections,
    ///  which in most cases means toggling the clicked item into or out of the selection.
    ModifySelection,
    /// when any of these modifiers is pressed, the
    ///  key event cannot produce a symbol directly. This is meant to be used for
    ///  input methods, and for use cases like typeahead search.
    NoTextInput,
    /// the modifier that switches between keyboard
    ///  groups (AltGr on X11/Windows and Option/Alt on OS X).
    ShiftGroup,
    /// The set of modifier masks accepted
    /// as modifiers in accelerators. Needed because Command is mapped to MOD2 on
    /// OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a
    /// mod key is problematic at best.
    /// Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125.
    DefaultModMask,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for ModifierIntent {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "ModifierIntent::{}",
            match *self {
                ModifierIntent::PrimaryAccelerator => "PrimaryAccelerator",
                ModifierIntent::ContextMenu => "ContextMenu",
                ModifierIntent::ExtendSelection => "ExtendSelection",
                ModifierIntent::ModifySelection => "ModifySelection",
                ModifierIntent::NoTextInput => "NoTextInput",
                ModifierIntent::ShiftGroup => "ShiftGroup",
                ModifierIntent::DefaultModMask => "DefaultModMask",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for ModifierIntent {
    type GlibType = gdk_sys::GdkModifierIntent;

    fn to_glib(&self) -> gdk_sys::GdkModifierIntent {
        match *self {
            ModifierIntent::PrimaryAccelerator => gdk_sys::GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
            ModifierIntent::ContextMenu => gdk_sys::GDK_MODIFIER_INTENT_CONTEXT_MENU,
            ModifierIntent::ExtendSelection => gdk_sys::GDK_MODIFIER_INTENT_EXTEND_SELECTION,
            ModifierIntent::ModifySelection => gdk_sys::GDK_MODIFIER_INTENT_MODIFY_SELECTION,
            ModifierIntent::NoTextInput => gdk_sys::GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
            ModifierIntent::ShiftGroup => gdk_sys::GDK_MODIFIER_INTENT_SHIFT_GROUP,
            ModifierIntent::DefaultModMask => gdk_sys::GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK,
            ModifierIntent::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkModifierIntent> for ModifierIntent {
    fn from_glib(value: gdk_sys::GdkModifierIntent) -> Self {
        skip_assert_initialized!();
        match value {
            0 => ModifierIntent::PrimaryAccelerator,
            1 => ModifierIntent::ContextMenu,
            2 => ModifierIntent::ExtendSelection,
            3 => ModifierIntent::ModifySelection,
            4 => ModifierIntent::NoTextInput,
            5 => ModifierIntent::ShiftGroup,
            6 => ModifierIntent::DefaultModMask,
            value => ModifierIntent::__Unknown(value),
        }
    }
}

impl StaticType for ModifierIntent {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_modifier_intent_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for ModifierIntent {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for ModifierIntent {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for ModifierIntent {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies the kind of crossing for `EventCrossing`.
///
/// See the X11 protocol specification of LeaveNotify for
/// full details of crossing event generation.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum NotifyType {
    /// the window is entered from an ancestor or
    ///  left towards an ancestor.
    Ancestor,
    /// the pointer moves between an ancestor and an
    ///  inferior of the window.
    Virtual,
    /// the window is entered from an inferior or
    ///  left towards an inferior.
    Inferior,
    /// the window is entered from or left towards
    ///  a window which is neither an ancestor nor an inferior.
    Nonlinear,
    /// the pointer moves between two windows
    ///  which are not ancestors of each other and the window is part of
    ///  the ancestor chain between one of these windows and their least
    ///  common ancestor.
    NonlinearVirtual,
    /// an unknown type of enter/leave event occurred.
    Unknown,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for NotifyType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "NotifyType::{}",
            match *self {
                NotifyType::Ancestor => "Ancestor",
                NotifyType::Virtual => "Virtual",
                NotifyType::Inferior => "Inferior",
                NotifyType::Nonlinear => "Nonlinear",
                NotifyType::NonlinearVirtual => "NonlinearVirtual",
                NotifyType::Unknown => "Unknown",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for NotifyType {
    type GlibType = gdk_sys::GdkNotifyType;

    fn to_glib(&self) -> gdk_sys::GdkNotifyType {
        match *self {
            NotifyType::Ancestor => gdk_sys::GDK_NOTIFY_ANCESTOR,
            NotifyType::Virtual => gdk_sys::GDK_NOTIFY_VIRTUAL,
            NotifyType::Inferior => gdk_sys::GDK_NOTIFY_INFERIOR,
            NotifyType::Nonlinear => gdk_sys::GDK_NOTIFY_NONLINEAR,
            NotifyType::NonlinearVirtual => gdk_sys::GDK_NOTIFY_NONLINEAR_VIRTUAL,
            NotifyType::Unknown => gdk_sys::GDK_NOTIFY_UNKNOWN,
            NotifyType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkNotifyType> for NotifyType {
    fn from_glib(value: gdk_sys::GdkNotifyType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => NotifyType::Ancestor,
            1 => NotifyType::Virtual,
            2 => NotifyType::Inferior,
            3 => NotifyType::Nonlinear,
            4 => NotifyType::NonlinearVirtual,
            5 => NotifyType::Unknown,
            value => NotifyType::__Unknown(value),
        }
    }
}

impl StaticType for NotifyType {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_notify_type_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for NotifyType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for NotifyType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for NotifyType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies why a selection ownership was changed.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum OwnerChange {
    /// some other app claimed the ownership
    NewOwner,
    /// the window was destroyed
    Destroy,
    /// the client was closed
    Close,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for OwnerChange {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "OwnerChange::{}",
            match *self {
                OwnerChange::NewOwner => "NewOwner",
                OwnerChange::Destroy => "Destroy",
                OwnerChange::Close => "Close",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for OwnerChange {
    type GlibType = gdk_sys::GdkOwnerChange;

    fn to_glib(&self) -> gdk_sys::GdkOwnerChange {
        match *self {
            OwnerChange::NewOwner => gdk_sys::GDK_OWNER_CHANGE_NEW_OWNER,
            OwnerChange::Destroy => gdk_sys::GDK_OWNER_CHANGE_DESTROY,
            OwnerChange::Close => gdk_sys::GDK_OWNER_CHANGE_CLOSE,
            OwnerChange::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkOwnerChange> for OwnerChange {
    fn from_glib(value: gdk_sys::GdkOwnerChange) -> Self {
        skip_assert_initialized!();
        match value {
            0 => OwnerChange::NewOwner,
            1 => OwnerChange::Destroy,
            2 => OwnerChange::Close,
            value => OwnerChange::__Unknown(value),
        }
    }
}

impl StaticType for OwnerChange {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_owner_change_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for OwnerChange {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for OwnerChange {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for OwnerChange {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Describes how existing data is combined with new data when
/// using `gdk_property_change`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum PropMode {
    /// the new data replaces the existing data.
    Replace,
    /// the new data is prepended to the existing data.
    Prepend,
    /// the new data is appended to the existing data.
    Append,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for PropMode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "PropMode::{}",
            match *self {
                PropMode::Replace => "Replace",
                PropMode::Prepend => "Prepend",
                PropMode::Append => "Append",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for PropMode {
    type GlibType = gdk_sys::GdkPropMode;

    fn to_glib(&self) -> gdk_sys::GdkPropMode {
        match *self {
            PropMode::Replace => gdk_sys::GDK_PROP_MODE_REPLACE,
            PropMode::Prepend => gdk_sys::GDK_PROP_MODE_PREPEND,
            PropMode::Append => gdk_sys::GDK_PROP_MODE_APPEND,
            PropMode::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkPropMode> for PropMode {
    fn from_glib(value: gdk_sys::GdkPropMode) -> Self {
        skip_assert_initialized!();
        match value {
            0 => PropMode::Replace,
            1 => PropMode::Prepend,
            2 => PropMode::Append,
            value => PropMode::__Unknown(value),
        }
    }
}

impl StaticType for PropMode {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_prop_mode_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for PropMode {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for PropMode {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for PropMode {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies the type of a property change for a `EventProperty`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum PropertyState {
    /// the property value was changed.
    NewValue,
    /// the property was deleted.
    Delete,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for PropertyState {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "PropertyState::{}",
            match *self {
                PropertyState::NewValue => "NewValue",
                PropertyState::Delete => "Delete",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for PropertyState {
    type GlibType = gdk_sys::GdkPropertyState;

    fn to_glib(&self) -> gdk_sys::GdkPropertyState {
        match *self {
            PropertyState::NewValue => gdk_sys::GDK_PROPERTY_NEW_VALUE,
            PropertyState::Delete => gdk_sys::GDK_PROPERTY_DELETE,
            PropertyState::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkPropertyState> for PropertyState {
    fn from_glib(value: gdk_sys::GdkPropertyState) -> Self {
        skip_assert_initialized!();
        match value {
            0 => PropertyState::NewValue,
            1 => PropertyState::Delete,
            value => PropertyState::__Unknown(value),
        }
    }
}

impl StaticType for PropertyState {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_property_state_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for PropertyState {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for PropertyState {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for PropertyState {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies the direction for `EventScroll`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum ScrollDirection {
    /// the window is scrolled up.
    Up,
    /// the window is scrolled down.
    Down,
    /// the window is scrolled to the left.
    Left,
    /// the window is scrolled to the right.
    Right,
    /// the scrolling is determined by the delta values
    ///  in `EventScroll`. See `gdk_event_get_scroll_deltas`. Since: 3.4
    Smooth,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for ScrollDirection {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "ScrollDirection::{}",
            match *self {
                ScrollDirection::Up => "Up",
                ScrollDirection::Down => "Down",
                ScrollDirection::Left => "Left",
                ScrollDirection::Right => "Right",
                ScrollDirection::Smooth => "Smooth",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for ScrollDirection {
    type GlibType = gdk_sys::GdkScrollDirection;

    fn to_glib(&self) -> gdk_sys::GdkScrollDirection {
        match *self {
            ScrollDirection::Up => gdk_sys::GDK_SCROLL_UP,
            ScrollDirection::Down => gdk_sys::GDK_SCROLL_DOWN,
            ScrollDirection::Left => gdk_sys::GDK_SCROLL_LEFT,
            ScrollDirection::Right => gdk_sys::GDK_SCROLL_RIGHT,
            ScrollDirection::Smooth => gdk_sys::GDK_SCROLL_SMOOTH,
            ScrollDirection::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkScrollDirection> for ScrollDirection {
    fn from_glib(value: gdk_sys::GdkScrollDirection) -> Self {
        skip_assert_initialized!();
        match value {
            0 => ScrollDirection::Up,
            1 => ScrollDirection::Down,
            2 => ScrollDirection::Left,
            3 => ScrollDirection::Right,
            4 => ScrollDirection::Smooth,
            value => ScrollDirection::__Unknown(value),
        }
    }
}

impl StaticType for ScrollDirection {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_scroll_direction_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for ScrollDirection {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for ScrollDirection {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for ScrollDirection {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies the kind of modification applied to a setting in a
/// `EventSetting`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum SettingAction {
    /// a setting was added.
    New,
    /// a setting was changed.
    Changed,
    /// a setting was deleted.
    Deleted,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for SettingAction {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "SettingAction::{}",
            match *self {
                SettingAction::New => "New",
                SettingAction::Changed => "Changed",
                SettingAction::Deleted => "Deleted",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for SettingAction {
    type GlibType = gdk_sys::GdkSettingAction;

    fn to_glib(&self) -> gdk_sys::GdkSettingAction {
        match *self {
            SettingAction::New => gdk_sys::GDK_SETTING_ACTION_NEW,
            SettingAction::Changed => gdk_sys::GDK_SETTING_ACTION_CHANGED,
            SettingAction::Deleted => gdk_sys::GDK_SETTING_ACTION_DELETED,
            SettingAction::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkSettingAction> for SettingAction {
    fn from_glib(value: gdk_sys::GdkSettingAction) -> Self {
        skip_assert_initialized!();
        match value {
            0 => SettingAction::New,
            1 => SettingAction::Changed,
            2 => SettingAction::Deleted,
            value => SettingAction::__Unknown(value),
        }
    }
}

impl StaticType for SettingAction {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_setting_action_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for SettingAction {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for SettingAction {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for SettingAction {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// This enumeration describes how the red, green and blue components
/// of physical pixels on an output device are laid out.
#[cfg(any(feature = "v3_22", feature = "dox"))]
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum SubpixelLayout {
    /// The layout is not known
    Unknown,
    /// Not organized in this way
    None,
    /// The layout is horizontal, the order is RGB
    HorizontalRgb,
    /// The layout is horizontal, the order is BGR
    HorizontalBgr,
    /// The layout is vertical, the order is RGB
    VerticalRgb,
    /// The layout is vertical, the order is BGR
    ///
    /// Feature: `v3_22`
    ///
    VerticalBgr,
    #[doc(hidden)]
    __Unknown(i32),
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl fmt::Display for SubpixelLayout {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "SubpixelLayout::{}",
            match *self {
                SubpixelLayout::Unknown => "Unknown",
                SubpixelLayout::None => "None",
                SubpixelLayout::HorizontalRgb => "HorizontalRgb",
                SubpixelLayout::HorizontalBgr => "HorizontalBgr",
                SubpixelLayout::VerticalRgb => "VerticalRgb",
                SubpixelLayout::VerticalBgr => "VerticalBgr",
                _ => "Unknown",
            }
        )
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl ToGlib for SubpixelLayout {
    type GlibType = gdk_sys::GdkSubpixelLayout;

    fn to_glib(&self) -> gdk_sys::GdkSubpixelLayout {
        match *self {
            SubpixelLayout::Unknown => gdk_sys::GDK_SUBPIXEL_LAYOUT_UNKNOWN,
            SubpixelLayout::None => gdk_sys::GDK_SUBPIXEL_LAYOUT_NONE,
            SubpixelLayout::HorizontalRgb => gdk_sys::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB,
            SubpixelLayout::HorizontalBgr => gdk_sys::GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR,
            SubpixelLayout::VerticalRgb => gdk_sys::GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB,
            SubpixelLayout::VerticalBgr => gdk_sys::GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR,
            SubpixelLayout::__Unknown(value) => value,
        }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
#[doc(hidden)]
impl FromGlib<gdk_sys::GdkSubpixelLayout> for SubpixelLayout {
    fn from_glib(value: gdk_sys::GdkSubpixelLayout) -> Self {
        skip_assert_initialized!();
        match value {
            0 => SubpixelLayout::Unknown,
            1 => SubpixelLayout::None,
            2 => SubpixelLayout::HorizontalRgb,
            3 => SubpixelLayout::HorizontalBgr,
            4 => SubpixelLayout::VerticalRgb,
            5 => SubpixelLayout::VerticalBgr,
            value => SubpixelLayout::__Unknown(value),
        }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl StaticType for SubpixelLayout {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_subpixel_layout_get_type()) }
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValueOptional<'a> for SubpixelLayout {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl<'a> FromValue<'a> for SubpixelLayout {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v3_22", feature = "dox"))]
impl SetValue for SubpixelLayout {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Specifies the visiblity status of a window for a `EventVisibility`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum VisibilityState {
    /// the window is completely visible.
    Unobscured,
    /// the window is partially visible.
    Partial,
    /// the window is not visible at all.
    FullyObscured,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for VisibilityState {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "VisibilityState::{}",
            match *self {
                VisibilityState::Unobscured => "Unobscured",
                VisibilityState::Partial => "Partial",
                VisibilityState::FullyObscured => "FullyObscured",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for VisibilityState {
    type GlibType = gdk_sys::GdkVisibilityState;

    fn to_glib(&self) -> gdk_sys::GdkVisibilityState {
        match *self {
            VisibilityState::Unobscured => gdk_sys::GDK_VISIBILITY_UNOBSCURED,
            VisibilityState::Partial => gdk_sys::GDK_VISIBILITY_PARTIAL,
            VisibilityState::FullyObscured => gdk_sys::GDK_VISIBILITY_FULLY_OBSCURED,
            VisibilityState::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkVisibilityState> for VisibilityState {
    fn from_glib(value: gdk_sys::GdkVisibilityState) -> Self {
        skip_assert_initialized!();
        match value {
            0 => VisibilityState::Unobscured,
            1 => VisibilityState::Partial,
            2 => VisibilityState::FullyObscured,
            value => VisibilityState::__Unknown(value),
        }
    }
}

impl StaticType for VisibilityState {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_visibility_state_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for VisibilityState {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for VisibilityState {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for VisibilityState {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// A set of values that describe the manner in which the pixel values
/// for a visual are converted into RGB values for display.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum VisualType {
    /// Each pixel value indexes a grayscale value
    ///  directly.
    StaticGray,
    /// Each pixel is an index into a color map that
    ///  maps pixel values into grayscale values. The color map can be
    ///  changed by an application.
    Grayscale,
    /// Each pixel value is an index into a predefined,
    ///  unmodifiable color map that maps pixel values into RGB values.
    StaticColor,
    /// Each pixel is an index into a color map that
    ///  maps pixel values into rgb values. The color map can be changed by
    ///  an application.
    PseudoColor,
    /// Each pixel value directly contains red, green,
    ///  and blue components. Use `Visual::get_red_pixel_details`, etc,
    ///  to obtain information about how the components are assembled into
    ///  a pixel value.
    TrueColor,
    /// Each pixel value contains red, green, and blue
    ///  components as for `VisualType::TrueColor`, but the components are
    ///  mapped via a color table into the final output table instead of
    ///  being converted directly.
    DirectColor,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for VisualType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "VisualType::{}",
            match *self {
                VisualType::StaticGray => "StaticGray",
                VisualType::Grayscale => "Grayscale",
                VisualType::StaticColor => "StaticColor",
                VisualType::PseudoColor => "PseudoColor",
                VisualType::TrueColor => "TrueColor",
                VisualType::DirectColor => "DirectColor",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for VisualType {
    type GlibType = gdk_sys::GdkVisualType;

    fn to_glib(&self) -> gdk_sys::GdkVisualType {
        match *self {
            VisualType::StaticGray => gdk_sys::GDK_VISUAL_STATIC_GRAY,
            VisualType::Grayscale => gdk_sys::GDK_VISUAL_GRAYSCALE,
            VisualType::StaticColor => gdk_sys::GDK_VISUAL_STATIC_COLOR,
            VisualType::PseudoColor => gdk_sys::GDK_VISUAL_PSEUDO_COLOR,
            VisualType::TrueColor => gdk_sys::GDK_VISUAL_TRUE_COLOR,
            VisualType::DirectColor => gdk_sys::GDK_VISUAL_DIRECT_COLOR,
            VisualType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkVisualType> for VisualType {
    fn from_glib(value: gdk_sys::GdkVisualType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => VisualType::StaticGray,
            1 => VisualType::Grayscale,
            2 => VisualType::StaticColor,
            3 => VisualType::PseudoColor,
            4 => VisualType::TrueColor,
            5 => VisualType::DirectColor,
            value => VisualType::__Unknown(value),
        }
    }
}

impl StaticType for VisualType {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_visual_type_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for VisualType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for VisualType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for VisualType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Determines a window edge or corner.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum WindowEdge {
    /// the top left corner.
    NorthWest,
    /// the top edge.
    North,
    /// the top right corner.
    NorthEast,
    /// the left edge.
    West,
    /// the right edge.
    East,
    /// the lower left corner.
    SouthWest,
    /// the lower edge.
    South,
    /// the lower right corner.
    SouthEast,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for WindowEdge {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "WindowEdge::{}",
            match *self {
                WindowEdge::NorthWest => "NorthWest",
                WindowEdge::North => "North",
                WindowEdge::NorthEast => "NorthEast",
                WindowEdge::West => "West",
                WindowEdge::East => "East",
                WindowEdge::SouthWest => "SouthWest",
                WindowEdge::South => "South",
                WindowEdge::SouthEast => "SouthEast",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for WindowEdge {
    type GlibType = gdk_sys::GdkWindowEdge;

    fn to_glib(&self) -> gdk_sys::GdkWindowEdge {
        match *self {
            WindowEdge::NorthWest => gdk_sys::GDK_WINDOW_EDGE_NORTH_WEST,
            WindowEdge::North => gdk_sys::GDK_WINDOW_EDGE_NORTH,
            WindowEdge::NorthEast => gdk_sys::GDK_WINDOW_EDGE_NORTH_EAST,
            WindowEdge::West => gdk_sys::GDK_WINDOW_EDGE_WEST,
            WindowEdge::East => gdk_sys::GDK_WINDOW_EDGE_EAST,
            WindowEdge::SouthWest => gdk_sys::GDK_WINDOW_EDGE_SOUTH_WEST,
            WindowEdge::South => gdk_sys::GDK_WINDOW_EDGE_SOUTH,
            WindowEdge::SouthEast => gdk_sys::GDK_WINDOW_EDGE_SOUTH_EAST,
            WindowEdge::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkWindowEdge> for WindowEdge {
    fn from_glib(value: gdk_sys::GdkWindowEdge) -> Self {
        skip_assert_initialized!();
        match value {
            0 => WindowEdge::NorthWest,
            1 => WindowEdge::North,
            2 => WindowEdge::NorthEast,
            3 => WindowEdge::West,
            4 => WindowEdge::East,
            5 => WindowEdge::SouthWest,
            6 => WindowEdge::South,
            7 => WindowEdge::SouthEast,
            value => WindowEdge::__Unknown(value),
        }
    }
}

impl StaticType for WindowEdge {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_window_edge_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for WindowEdge {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WindowEdge {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for WindowEdge {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Describes the kind of window.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum WindowType {
    /// root window; this window has no parent, covers the entire
    ///  screen, and is created by the window system
    Root,
    /// toplevel window (used to implement ``GtkWindow``)
    Toplevel,
    /// child window (used to implement e.g. ``GtkEntry``)
    Child,
    /// override redirect temporary window (used to implement
    ///  ``GtkMenu``)
    Temp,
    /// foreign window (see `gdk_window_foreign_new`)
    Foreign,
    /// offscreen window (see
    ///  [Offscreen Windows][OFFSCREEN-WINDOWS]). Since 2.18
    Offscreen,
    /// subsurface-based window; This window is visually
    ///  tied to a toplevel, and is moved/stacked with it. Currently this window
    ///  type is only implemented in Wayland. Since 3.14
    Subsurface,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for WindowType {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "WindowType::{}",
            match *self {
                WindowType::Root => "Root",
                WindowType::Toplevel => "Toplevel",
                WindowType::Child => "Child",
                WindowType::Temp => "Temp",
                WindowType::Foreign => "Foreign",
                WindowType::Offscreen => "Offscreen",
                WindowType::Subsurface => "Subsurface",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for WindowType {
    type GlibType = gdk_sys::GdkWindowType;

    fn to_glib(&self) -> gdk_sys::GdkWindowType {
        match *self {
            WindowType::Root => gdk_sys::GDK_WINDOW_ROOT,
            WindowType::Toplevel => gdk_sys::GDK_WINDOW_TOPLEVEL,
            WindowType::Child => gdk_sys::GDK_WINDOW_CHILD,
            WindowType::Temp => gdk_sys::GDK_WINDOW_TEMP,
            WindowType::Foreign => gdk_sys::GDK_WINDOW_FOREIGN,
            WindowType::Offscreen => gdk_sys::GDK_WINDOW_OFFSCREEN,
            WindowType::Subsurface => gdk_sys::GDK_WINDOW_SUBSURFACE,
            WindowType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkWindowType> for WindowType {
    fn from_glib(value: gdk_sys::GdkWindowType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => WindowType::Root,
            1 => WindowType::Toplevel,
            2 => WindowType::Child,
            3 => WindowType::Temp,
            4 => WindowType::Foreign,
            5 => WindowType::Offscreen,
            6 => WindowType::Subsurface,
            value => WindowType::__Unknown(value),
        }
    }
}

impl StaticType for WindowType {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_window_type_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for WindowType {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WindowType {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for WindowType {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// These are hints for the window manager that indicate what type of function
/// the window has. The window manager can use this when determining decoration
/// and behaviour of the window. The hint must be set before mapping the window.
///
/// See the [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec)
/// specification for more details about window types.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum WindowTypeHint {
    /// Normal toplevel window.
    Normal,
    /// Dialog window.
    Dialog,
    /// Window used to implement a menu; GTK+ uses
    ///  this hint only for torn-off menus, see ``GtkTearoffMenuItem``.
    Menu,
    /// Window used to implement toolbars.
    Toolbar,
    /// Window used to display a splash
    ///  screen during application startup.
    Splashscreen,
    /// Utility windows which are not detached
    ///  toolbars or dialogs.
    Utility,
    /// Used for creating dock or panel windows.
    Dock,
    /// Used for creating the desktop background
    ///  window.
    Desktop,
    /// A menu that belongs to a menubar.
    DropdownMenu,
    /// A menu that does not belong to a menubar,
    ///  e.g. a context menu.
    PopupMenu,
    /// A tooltip.
    Tooltip,
    /// A notification - typically a “bubble”
    ///  that belongs to a status icon.
    Notification,
    /// A popup from a combo box.
    Combo,
    /// A window that is used to implement a DND cursor.
    Dnd,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for WindowTypeHint {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "WindowTypeHint::{}",
            match *self {
                WindowTypeHint::Normal => "Normal",
                WindowTypeHint::Dialog => "Dialog",
                WindowTypeHint::Menu => "Menu",
                WindowTypeHint::Toolbar => "Toolbar",
                WindowTypeHint::Splashscreen => "Splashscreen",
                WindowTypeHint::Utility => "Utility",
                WindowTypeHint::Dock => "Dock",
                WindowTypeHint::Desktop => "Desktop",
                WindowTypeHint::DropdownMenu => "DropdownMenu",
                WindowTypeHint::PopupMenu => "PopupMenu",
                WindowTypeHint::Tooltip => "Tooltip",
                WindowTypeHint::Notification => "Notification",
                WindowTypeHint::Combo => "Combo",
                WindowTypeHint::Dnd => "Dnd",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for WindowTypeHint {
    type GlibType = gdk_sys::GdkWindowTypeHint;

    fn to_glib(&self) -> gdk_sys::GdkWindowTypeHint {
        match *self {
            WindowTypeHint::Normal => gdk_sys::GDK_WINDOW_TYPE_HINT_NORMAL,
            WindowTypeHint::Dialog => gdk_sys::GDK_WINDOW_TYPE_HINT_DIALOG,
            WindowTypeHint::Menu => gdk_sys::GDK_WINDOW_TYPE_HINT_MENU,
            WindowTypeHint::Toolbar => gdk_sys::GDK_WINDOW_TYPE_HINT_TOOLBAR,
            WindowTypeHint::Splashscreen => gdk_sys::GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
            WindowTypeHint::Utility => gdk_sys::GDK_WINDOW_TYPE_HINT_UTILITY,
            WindowTypeHint::Dock => gdk_sys::GDK_WINDOW_TYPE_HINT_DOCK,
            WindowTypeHint::Desktop => gdk_sys::GDK_WINDOW_TYPE_HINT_DESKTOP,
            WindowTypeHint::DropdownMenu => gdk_sys::GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU,
            WindowTypeHint::PopupMenu => gdk_sys::GDK_WINDOW_TYPE_HINT_POPUP_MENU,
            WindowTypeHint::Tooltip => gdk_sys::GDK_WINDOW_TYPE_HINT_TOOLTIP,
            WindowTypeHint::Notification => gdk_sys::GDK_WINDOW_TYPE_HINT_NOTIFICATION,
            WindowTypeHint::Combo => gdk_sys::GDK_WINDOW_TYPE_HINT_COMBO,
            WindowTypeHint::Dnd => gdk_sys::GDK_WINDOW_TYPE_HINT_DND,
            WindowTypeHint::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkWindowTypeHint> for WindowTypeHint {
    fn from_glib(value: gdk_sys::GdkWindowTypeHint) -> Self {
        skip_assert_initialized!();
        match value {
            0 => WindowTypeHint::Normal,
            1 => WindowTypeHint::Dialog,
            2 => WindowTypeHint::Menu,
            3 => WindowTypeHint::Toolbar,
            4 => WindowTypeHint::Splashscreen,
            5 => WindowTypeHint::Utility,
            6 => WindowTypeHint::Dock,
            7 => WindowTypeHint::Desktop,
            8 => WindowTypeHint::DropdownMenu,
            9 => WindowTypeHint::PopupMenu,
            10 => WindowTypeHint::Tooltip,
            11 => WindowTypeHint::Notification,
            12 => WindowTypeHint::Combo,
            13 => WindowTypeHint::Dnd,
            value => WindowTypeHint::__Unknown(value),
        }
    }
}

impl StaticType for WindowTypeHint {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_window_type_hint_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for WindowTypeHint {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WindowTypeHint {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for WindowTypeHint {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// `WindowWindowClass::InputOutput` windows are the standard kind of window you might expect.
/// Such windows receive events and are also displayed on screen.
/// `WindowWindowClass::InputOnly` windows are invisible; they are usually placed above other
/// windows in order to trap or filter the events. You can’t draw on
/// `WindowWindowClass::InputOnly` windows.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum WindowWindowClass {
    /// window for graphics and events
    InputOutput,
    /// window for events only
    InputOnly,
    #[doc(hidden)]
    __Unknown(i32),
}

impl fmt::Display for WindowWindowClass {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(
            f,
            "WindowWindowClass::{}",
            match *self {
                WindowWindowClass::InputOutput => "InputOutput",
                WindowWindowClass::InputOnly => "InputOnly",
                _ => "Unknown",
            }
        )
    }
}

#[doc(hidden)]
impl ToGlib for WindowWindowClass {
    type GlibType = gdk_sys::GdkWindowWindowClass;

    fn to_glib(&self) -> gdk_sys::GdkWindowWindowClass {
        match *self {
            WindowWindowClass::InputOutput => gdk_sys::GDK_INPUT_OUTPUT,
            WindowWindowClass::InputOnly => gdk_sys::GDK_INPUT_ONLY,
            WindowWindowClass::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gdk_sys::GdkWindowWindowClass> for WindowWindowClass {
    fn from_glib(value: gdk_sys::GdkWindowWindowClass) -> Self {
        skip_assert_initialized!();
        match value {
            0 => WindowWindowClass::InputOutput,
            1 => WindowWindowClass::InputOnly,
            value => WindowWindowClass::__Unknown(value),
        }
    }
}

impl StaticType for WindowWindowClass {
    fn static_type() -> Type {
        unsafe { from_glib(gdk_sys::gdk_window_window_class_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for WindowWindowClass {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for WindowWindowClass {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for WindowWindowClass {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}