libghostty-vt-sys 0.1.1

Raw FFI bindings for libghostty-vt, the Ghostty terminal emulation library
Documentation
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
/* automatically generated by rust-bindgen 0.72.1 */

pub const GHOSTTY_COLOR_NAMED_BLACK: u32 = 0;
pub const GHOSTTY_COLOR_NAMED_RED: u32 = 1;
pub const GHOSTTY_COLOR_NAMED_GREEN: u32 = 2;
pub const GHOSTTY_COLOR_NAMED_YELLOW: u32 = 3;
pub const GHOSTTY_COLOR_NAMED_BLUE: u32 = 4;
pub const GHOSTTY_COLOR_NAMED_MAGENTA: u32 = 5;
pub const GHOSTTY_COLOR_NAMED_CYAN: u32 = 6;
pub const GHOSTTY_COLOR_NAMED_WHITE: u32 = 7;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_BLACK: u32 = 8;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_RED: u32 = 9;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_GREEN: u32 = 10;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_YELLOW: u32 = 11;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_BLUE: u32 = 12;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_MAGENTA: u32 = 13;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_CYAN: u32 = 14;
pub const GHOSTTY_COLOR_NAMED_BRIGHT_WHITE: u32 = 15;
pub const GHOSTTY_DA_CONFORMANCE_VT100: u32 = 1;
pub const GHOSTTY_DA_CONFORMANCE_VT101: u32 = 1;
pub const GHOSTTY_DA_CONFORMANCE_VT102: u32 = 6;
pub const GHOSTTY_DA_CONFORMANCE_VT125: u32 = 12;
pub const GHOSTTY_DA_CONFORMANCE_VT131: u32 = 7;
pub const GHOSTTY_DA_CONFORMANCE_VT132: u32 = 4;
pub const GHOSTTY_DA_CONFORMANCE_VT220: u32 = 62;
pub const GHOSTTY_DA_CONFORMANCE_VT240: u32 = 62;
pub const GHOSTTY_DA_CONFORMANCE_VT320: u32 = 63;
pub const GHOSTTY_DA_CONFORMANCE_VT340: u32 = 63;
pub const GHOSTTY_DA_CONFORMANCE_VT420: u32 = 64;
pub const GHOSTTY_DA_CONFORMANCE_VT510: u32 = 65;
pub const GHOSTTY_DA_CONFORMANCE_VT520: u32 = 65;
pub const GHOSTTY_DA_CONFORMANCE_VT525: u32 = 65;
pub const GHOSTTY_DA_CONFORMANCE_LEVEL_2: u32 = 62;
pub const GHOSTTY_DA_CONFORMANCE_LEVEL_3: u32 = 63;
pub const GHOSTTY_DA_CONFORMANCE_LEVEL_4: u32 = 64;
pub const GHOSTTY_DA_CONFORMANCE_LEVEL_5: u32 = 65;
pub const GHOSTTY_DA_FEATURE_COLUMNS_132: u32 = 1;
pub const GHOSTTY_DA_FEATURE_PRINTER: u32 = 2;
pub const GHOSTTY_DA_FEATURE_REGIS: u32 = 3;
pub const GHOSTTY_DA_FEATURE_SIXEL: u32 = 4;
pub const GHOSTTY_DA_FEATURE_SELECTIVE_ERASE: u32 = 6;
pub const GHOSTTY_DA_FEATURE_USER_DEFINED_KEYS: u32 = 8;
pub const GHOSTTY_DA_FEATURE_NATIONAL_REPLACEMENT: u32 = 9;
pub const GHOSTTY_DA_FEATURE_TECHNICAL_CHARACTERS: u32 = 15;
pub const GHOSTTY_DA_FEATURE_LOCATOR: u32 = 16;
pub const GHOSTTY_DA_FEATURE_TERMINAL_STATE: u32 = 17;
pub const GHOSTTY_DA_FEATURE_WINDOWING: u32 = 18;
pub const GHOSTTY_DA_FEATURE_HORIZONTAL_SCROLLING: u32 = 21;
pub const GHOSTTY_DA_FEATURE_ANSI_COLOR: u32 = 22;
pub const GHOSTTY_DA_FEATURE_RECTANGULAR_EDITING: u32 = 28;
pub const GHOSTTY_DA_FEATURE_ANSI_TEXT_LOCATOR: u32 = 29;
pub const GHOSTTY_DA_FEATURE_CLIPBOARD: u32 = 52;
pub const GHOSTTY_DA_DEVICE_TYPE_VT100: u32 = 0;
pub const GHOSTTY_DA_DEVICE_TYPE_VT220: u32 = 1;
pub const GHOSTTY_DA_DEVICE_TYPE_VT240: u32 = 2;
pub const GHOSTTY_DA_DEVICE_TYPE_VT330: u32 = 18;
pub const GHOSTTY_DA_DEVICE_TYPE_VT340: u32 = 19;
pub const GHOSTTY_DA_DEVICE_TYPE_VT320: u32 = 24;
pub const GHOSTTY_DA_DEVICE_TYPE_VT382: u32 = 32;
pub const GHOSTTY_DA_DEVICE_TYPE_VT420: u32 = 41;
pub const GHOSTTY_DA_DEVICE_TYPE_VT510: u32 = 61;
pub const GHOSTTY_DA_DEVICE_TYPE_VT520: u32 = 64;
pub const GHOSTTY_DA_DEVICE_TYPE_VT525: u32 = 65;
pub const GHOSTTY_MODS_SHIFT: u32 = 1;
pub const GHOSTTY_MODS_CTRL: u32 = 2;
pub const GHOSTTY_MODS_ALT: u32 = 4;
pub const GHOSTTY_MODS_SUPER: u32 = 8;
pub const GHOSTTY_MODS_CAPS_LOCK: u32 = 16;
pub const GHOSTTY_MODS_NUM_LOCK: u32 = 32;
pub const GHOSTTY_MODS_SHIFT_SIDE: u32 = 64;
pub const GHOSTTY_MODS_CTRL_SIDE: u32 = 128;
pub const GHOSTTY_MODS_ALT_SIDE: u32 = 256;
pub const GHOSTTY_MODS_SUPER_SIDE: u32 = 512;
pub const GHOSTTY_KITTY_KEY_DISABLED: u32 = 0;
pub const GHOSTTY_KITTY_KEY_DISAMBIGUATE: u32 = 1;
pub const GHOSTTY_KITTY_KEY_REPORT_EVENTS: u32 = 2;
pub const GHOSTTY_KITTY_KEY_REPORT_ALTERNATES: u32 = 4;
pub const GHOSTTY_KITTY_KEY_REPORT_ALL: u32 = 8;
pub const GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED: u32 = 16;
pub const GHOSTTY_KITTY_KEY_ALL: u32 = 31;
#[doc = " Operation completed successfully"]
pub const GhosttyResult_GHOSTTY_SUCCESS: GhosttyResult = 0;
#[doc = " Operation failed due to failed allocation"]
pub const GhosttyResult_GHOSTTY_OUT_OF_MEMORY: GhosttyResult = -1;
#[doc = " Operation failed due to invalid value"]
pub const GhosttyResult_GHOSTTY_INVALID_VALUE: GhosttyResult = -2;
#[doc = " Operation failed because the provided buffer was too small"]
pub const GhosttyResult_GHOSTTY_OUT_OF_SPACE: GhosttyResult = -3;
#[doc = " Result codes for libghostty-vt operations."]
pub type GhosttyResult = ::std::os::raw::c_int;
#[doc = " A borrowed byte string (pointer + length).\n\n The memory is not owned by this struct. The pointer is only valid\n for the lifetime documented by the API that produces or consumes it."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyString {
    #[doc = " Pointer to the string bytes."]
    pub ptr: *const u8,
    #[doc = " Length of the string in bytes."]
    pub len: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyString"][::std::mem::size_of::<GhosttyString>() - 16usize];
    ["Alignment of GhosttyString"][::std::mem::align_of::<GhosttyString>() - 8usize];
    ["Offset of field: GhosttyString::ptr"][::std::mem::offset_of!(GhosttyString, ptr) - 0usize];
    ["Offset of field: GhosttyString::len"][::std::mem::offset_of!(GhosttyString, len) - 8usize];
};
impl Default for GhosttyString {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Function table for custom memory allocator operations.\n\n This vtable defines the interface for a custom memory allocator. All\n function pointers must be valid and non-NULL.\n\n @ingroup allocator\n\n If you're not going to use a custom allocator, you can ignore all of\n this. All functions that take an allocator pointer allow NULL to use a\n default allocator.\n\n The interface is based on the Zig allocator interface. I'll say up front\n that it is easy to look at this interface and think \"wow, this is really\n overcomplicated\". The reason for this complexity is well thought out by\n the Zig folks, and it enables a diverse set of allocation strategies\n as shown by the Zig ecosystem. As a consolation, please note that many\n of the arguments are only needed for advanced use cases and can be\n safely ignored in simple implementations. For example, if you look at\n the Zig implementation of the libc allocator in `lib/std/heap.zig`\n (search for CAllocator), you'll see it is very simple.\n\n We chose to align with the Zig allocator interface because:\n\n   1. It is a proven interface that serves a wide variety of use cases\n      in the real world via the Zig ecosystem. It's shown to work.\n\n   2. Our core implementation itself is Zig, and this lets us very\n      cheaply and easily convert between C and Zig allocators.\n\n NOTE(mitchellh): In the future, we can have default implementations of\n resize/remap and allow those to be null."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyAllocatorVtable {
    #[doc = " Return a pointer to `len` bytes with specified `alignment`, or return\n `NULL` indicating the allocation failed.\n\n @param ctx The allocator context\n @param len Number of bytes to allocate\n @param alignment Required alignment for the allocation. Guaranteed to\n   be a power of two between 1 and 16 inclusive.\n @param ret_addr First return address of the allocation call stack (0 if not provided)\n @return Pointer to allocated memory, or NULL if allocation failed"]
    pub alloc: ::std::option::Option<
        unsafe extern "C" fn(
            ctx: *mut ::std::os::raw::c_void,
            len: usize,
            alignment: u8,
            ret_addr: usize,
        ) -> *mut ::std::os::raw::c_void,
    >,
    #[doc = " Attempt to expand or shrink memory in place.\n\n `memory_len` must equal the length requested from the most recent\n successful call to `alloc`, `resize`, or `remap`. `alignment` must\n equal the same value that was passed as the `alignment` parameter to\n the original `alloc` call.\n\n `new_len` must be greater than zero.\n\n @param ctx The allocator context\n @param memory Pointer to the memory block to resize\n @param memory_len Current size of the memory block\n @param alignment Alignment (must match original allocation)\n @param new_len New requested size\n @param ret_addr First return address of the allocation call stack (0 if not provided)\n @return true if resize was successful in-place, false if relocation would be required"]
    pub resize: ::std::option::Option<
        unsafe extern "C" fn(
            ctx: *mut ::std::os::raw::c_void,
            memory: *mut ::std::os::raw::c_void,
            memory_len: usize,
            alignment: u8,
            new_len: usize,
            ret_addr: usize,
        ) -> bool,
    >,
    #[doc = " Attempt to expand or shrink memory, allowing relocation.\n\n `memory_len` must equal the length requested from the most recent\n successful call to `alloc`, `resize`, or `remap`. `alignment` must\n equal the same value that was passed as the `alignment` parameter to\n the original `alloc` call.\n\n A non-`NULL` return value indicates the resize was successful. The\n allocation may have same address, or may have been relocated. In either\n case, the allocation now has size of `new_len`. A `NULL` return value\n indicates that the resize would be equivalent to allocating new memory,\n copying the bytes from the old memory, and then freeing the old memory.\n In such case, it is more efficient for the caller to perform the copy.\n\n `new_len` must be greater than zero.\n\n @param ctx The allocator context\n @param memory Pointer to the memory block to remap\n @param memory_len Current size of the memory block\n @param alignment Alignment (must match original allocation)\n @param new_len New requested size\n @param ret_addr First return address of the allocation call stack (0 if not provided)\n @return Pointer to resized memory (may be relocated), or NULL if manual copy is needed"]
    pub remap: ::std::option::Option<
        unsafe extern "C" fn(
            ctx: *mut ::std::os::raw::c_void,
            memory: *mut ::std::os::raw::c_void,
            memory_len: usize,
            alignment: u8,
            new_len: usize,
            ret_addr: usize,
        ) -> *mut ::std::os::raw::c_void,
    >,
    #[doc = " Free and invalidate a region of memory.\n\n `memory_len` must equal the length requested from the most recent\n successful call to `alloc`, `resize`, or `remap`. `alignment` must\n equal the same value that was passed as the `alignment` parameter to\n the original `alloc` call.\n\n @param ctx The allocator context\n @param memory Pointer to the memory block to free\n @param memory_len Size of the memory block\n @param alignment Alignment (must match original allocation)\n @param ret_addr First return address of the allocation call stack (0 if not provided)"]
    pub free: ::std::option::Option<
        unsafe extern "C" fn(
            ctx: *mut ::std::os::raw::c_void,
            memory: *mut ::std::os::raw::c_void,
            memory_len: usize,
            alignment: u8,
            ret_addr: usize,
        ),
    >,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyAllocatorVtable"][::std::mem::size_of::<GhosttyAllocatorVtable>() - 32usize];
    ["Alignment of GhosttyAllocatorVtable"]
        [::std::mem::align_of::<GhosttyAllocatorVtable>() - 8usize];
    ["Offset of field: GhosttyAllocatorVtable::alloc"]
        [::std::mem::offset_of!(GhosttyAllocatorVtable, alloc) - 0usize];
    ["Offset of field: GhosttyAllocatorVtable::resize"]
        [::std::mem::offset_of!(GhosttyAllocatorVtable, resize) - 8usize];
    ["Offset of field: GhosttyAllocatorVtable::remap"]
        [::std::mem::offset_of!(GhosttyAllocatorVtable, remap) - 16usize];
    ["Offset of field: GhosttyAllocatorVtable::free"]
        [::std::mem::offset_of!(GhosttyAllocatorVtable, free) - 24usize];
};
#[doc = " Custom memory allocator.\n\n For functions that take an allocator pointer, a NULL pointer indicates\n that the default allocator should be used. The default allocator will\n be libc malloc/free if we're linking to libc. If libc isn't linked,\n a custom allocator is used (currently Zig's SMP allocator).\n\n @ingroup allocator\n\n Usage example:\n @code\n GhosttyAllocator allocator = {\n     .vtable = &my_allocator_vtable,\n     .ctx = my_allocator_state\n };\n @endcode"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyAllocator {
    #[doc = " Opaque context pointer passed to all vtable functions.\n This allows the allocator implementation to maintain state\n or reference external resources needed for memory management."]
    pub ctx: *mut ::std::os::raw::c_void,
    #[doc = " Pointer to the allocator's vtable containing function pointers\n for memory operations (alloc, resize, remap, free)."]
    pub vtable: *const GhosttyAllocatorVtable,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyAllocator"][::std::mem::size_of::<GhosttyAllocator>() - 16usize];
    ["Alignment of GhosttyAllocator"][::std::mem::align_of::<GhosttyAllocator>() - 8usize];
    ["Offset of field: GhosttyAllocator::ctx"]
        [::std::mem::offset_of!(GhosttyAllocator, ctx) - 0usize];
    ["Offset of field: GhosttyAllocator::vtable"]
        [::std::mem::offset_of!(GhosttyAllocator, vtable) - 8usize];
};
impl Default for GhosttyAllocator {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
unsafe extern "C" {
    #[doc = " Allocate a buffer of `len` bytes.\n\n Uses the provided allocator, or the default allocator if NULL is passed.\n The returned buffer must be freed with ghostty_free() using the same\n allocator.\n\n @param allocator Pointer to the allocator to use, or NULL for the default\n @param len Number of bytes to allocate\n @return Pointer to the allocated buffer, or NULL if allocation failed\n\n @ingroup allocator"]
    pub fn ghostty_alloc(allocator: *const GhosttyAllocator, len: usize) -> *mut u8;
}
unsafe extern "C" {
    #[doc = " Free memory that was allocated by a libghostty-vt function.\n\n Use this to free buffers returned by functions such as\n ghostty_formatter_format_alloc(). Pass the same allocator that was\n used for the allocation, or NULL if the default allocator was used.\n\n On platforms where the library's internal allocator differs from the\n consumer's C runtime (e.g. Windows, where Zig's libc and MSVC's CRT\n maintain separate heaps), calling the standard C free() on memory\n allocated by the library causes undefined behavior. This function\n guarantees the correct allocator is used regardless of platform.\n\n It is safe to pass a NULL pointer; the call is a no-op in that case.\n\n @param allocator Pointer to the allocator that was used to allocate the\n   memory, or NULL if the default allocator was used\n @param ptr Pointer to the memory to free (may be NULL)\n @param len Length of the allocation in bytes (must match the original\n   allocation size)\n\n @ingroup allocator"]
    pub fn ghostty_free(allocator: *const GhosttyAllocator, ptr: *mut u8, len: usize);
}
pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_DEBUG: GhosttyOptimizeMode = 0;
pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_RELEASE_SAFE: GhosttyOptimizeMode = 1;
pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_RELEASE_SMALL: GhosttyOptimizeMode = 2;
pub const GhosttyOptimizeMode_GHOSTTY_OPTIMIZE_RELEASE_FAST: GhosttyOptimizeMode = 3;
#[doc = " Build optimization mode."]
pub type GhosttyOptimizeMode = ::std::os::raw::c_uint;
#[doc = " Invalid data type. Never results in any data extraction."]
pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_INVALID: GhosttyBuildInfo = 0;
#[doc = " Whether SIMD-accelerated code paths are enabled.\n\n Output type: bool *"]
pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_SIMD: GhosttyBuildInfo = 1;
#[doc = " Whether Kitty graphics protocol support is available.\n\n Output type: bool *"]
pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_KITTY_GRAPHICS: GhosttyBuildInfo = 2;
#[doc = " Whether tmux control mode support is available.\n\n Output type: bool *"]
pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_TMUX_CONTROL_MODE: GhosttyBuildInfo = 3;
#[doc = " The optimization mode the library was built with.\n\n Output type: GhosttyOptimizeMode *"]
pub const GhosttyBuildInfo_GHOSTTY_BUILD_INFO_OPTIMIZE: GhosttyBuildInfo = 4;
#[doc = " Build info data types that can be queried.\n\n Each variant documents the expected output pointer type."]
pub type GhosttyBuildInfo = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Query a compile-time build configuration value.\n\n The caller must pass a pointer to the correct output type for the\n requested data (see GhosttyBuildInfo variants for types).\n\n @param data The build info field to query\n @param out Pointer to store the result (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the\n         data type is invalid\n\n @ingroup build_info"]
    pub fn ghostty_build_info(
        data: GhosttyBuildInfo,
        out: *mut ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
#[doc = " RGB color value.\n\n @ingroup sgr"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyColorRgb {
    #[doc = "< Red component (0-255)"]
    pub r: u8,
    #[doc = "< Green component (0-255)"]
    pub g: u8,
    #[doc = "< Blue component (0-255)"]
    pub b: u8,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyColorRgb"][::std::mem::size_of::<GhosttyColorRgb>() - 3usize];
    ["Alignment of GhosttyColorRgb"][::std::mem::align_of::<GhosttyColorRgb>() - 1usize];
    ["Offset of field: GhosttyColorRgb::r"][::std::mem::offset_of!(GhosttyColorRgb, r) - 0usize];
    ["Offset of field: GhosttyColorRgb::g"][::std::mem::offset_of!(GhosttyColorRgb, g) - 1usize];
    ["Offset of field: GhosttyColorRgb::b"][::std::mem::offset_of!(GhosttyColorRgb, b) - 2usize];
};
#[doc = " Palette color index (0-255).\n\n @ingroup sgr"]
pub type GhosttyColorPaletteIndex = u8;
unsafe extern "C" {
    #[doc = " Get the RGB color components.\n\n This function extracts the individual red, green, and blue components\n from a GhosttyColorRgb value. Primarily useful in WebAssembly environments\n where accessing struct fields directly is difficult.\n\n @param color The RGB color value\n @param r Pointer to store the red component (0-255)\n @param g Pointer to store the green component (0-255)\n @param b Pointer to store the blue component (0-255)\n\n @ingroup sgr"]
    pub fn ghostty_color_rgb_get(color: GhosttyColorRgb, r: *mut u8, g: *mut u8, b: *mut u8);
}
pub const GhosttyColorScheme_GHOSTTY_COLOR_SCHEME_LIGHT: GhosttyColorScheme = 0;
pub const GhosttyColorScheme_GHOSTTY_COLOR_SCHEME_DARK: GhosttyColorScheme = 1;
#[doc = " Color scheme reported in response to a CSI ? 996 n query.\n\n @ingroup terminal"]
pub type GhosttyColorScheme = ::std::os::raw::c_uint;
#[doc = " Primary device attributes (DA1) response data.\n\n Returned as part of GhosttyDeviceAttributes in response to a CSI c query.\n The conformance_level is the Pp parameter and features contains the Ps\n feature codes.\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyDeviceAttributesPrimary {
    #[doc = " Conformance level (Pp parameter). E.g. 62 for VT220."]
    pub conformance_level: u16,
    #[doc = " DA1 feature codes. Only the first num_features entries are valid."]
    pub features: [u16; 64usize],
    #[doc = " Number of valid entries in the features array."]
    pub num_features: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyDeviceAttributesPrimary"]
        [::std::mem::size_of::<GhosttyDeviceAttributesPrimary>() - 144usize];
    ["Alignment of GhosttyDeviceAttributesPrimary"]
        [::std::mem::align_of::<GhosttyDeviceAttributesPrimary>() - 8usize];
    ["Offset of field: GhosttyDeviceAttributesPrimary::conformance_level"]
        [::std::mem::offset_of!(GhosttyDeviceAttributesPrimary, conformance_level) - 0usize];
    ["Offset of field: GhosttyDeviceAttributesPrimary::features"]
        [::std::mem::offset_of!(GhosttyDeviceAttributesPrimary, features) - 2usize];
    ["Offset of field: GhosttyDeviceAttributesPrimary::num_features"]
        [::std::mem::offset_of!(GhosttyDeviceAttributesPrimary, num_features) - 136usize];
};
impl Default for GhosttyDeviceAttributesPrimary {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Secondary device attributes (DA2) response data.\n\n Returned as part of GhosttyDeviceAttributes in response to a CSI > c query.\n Response format: CSI > Pp ; Pv ; Pc c\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyDeviceAttributesSecondary {
    #[doc = " Terminal type identifier (Pp). E.g. 1 for VT220."]
    pub device_type: u16,
    #[doc = " Firmware/patch version number (Pv)."]
    pub firmware_version: u16,
    #[doc = " ROM cartridge registration number (Pc). Always 0 for emulators."]
    pub rom_cartridge: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyDeviceAttributesSecondary"]
        [::std::mem::size_of::<GhosttyDeviceAttributesSecondary>() - 6usize];
    ["Alignment of GhosttyDeviceAttributesSecondary"]
        [::std::mem::align_of::<GhosttyDeviceAttributesSecondary>() - 2usize];
    ["Offset of field: GhosttyDeviceAttributesSecondary::device_type"]
        [::std::mem::offset_of!(GhosttyDeviceAttributesSecondary, device_type) - 0usize];
    ["Offset of field: GhosttyDeviceAttributesSecondary::firmware_version"]
        [::std::mem::offset_of!(GhosttyDeviceAttributesSecondary, firmware_version) - 2usize];
    ["Offset of field: GhosttyDeviceAttributesSecondary::rom_cartridge"]
        [::std::mem::offset_of!(GhosttyDeviceAttributesSecondary, rom_cartridge) - 4usize];
};
#[doc = " Tertiary device attributes (DA3) response data.\n\n Returned as part of GhosttyDeviceAttributes in response to a CSI = c query.\n Response format: DCS ! | D...D ST (DECRPTUI).\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyDeviceAttributesTertiary {
    #[doc = " Unit ID encoded as 8 uppercase hex digits in the response."]
    pub unit_id: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyDeviceAttributesTertiary"]
        [::std::mem::size_of::<GhosttyDeviceAttributesTertiary>() - 4usize];
    ["Alignment of GhosttyDeviceAttributesTertiary"]
        [::std::mem::align_of::<GhosttyDeviceAttributesTertiary>() - 4usize];
    ["Offset of field: GhosttyDeviceAttributesTertiary::unit_id"]
        [::std::mem::offset_of!(GhosttyDeviceAttributesTertiary, unit_id) - 0usize];
};
#[doc = " Device attributes response data for all three DA levels.\n\n Filled by the device_attributes callback in response to CSI c,\n CSI > c, or CSI = c queries. The terminal uses whichever sub-struct\n matches the request type.\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyDeviceAttributes {
    pub primary: GhosttyDeviceAttributesPrimary,
    pub secondary: GhosttyDeviceAttributesSecondary,
    pub tertiary: GhosttyDeviceAttributesTertiary,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyDeviceAttributes"]
        [::std::mem::size_of::<GhosttyDeviceAttributes>() - 160usize];
    ["Alignment of GhosttyDeviceAttributes"]
        [::std::mem::align_of::<GhosttyDeviceAttributes>() - 8usize];
    ["Offset of field: GhosttyDeviceAttributes::primary"]
        [::std::mem::offset_of!(GhosttyDeviceAttributes, primary) - 0usize];
    ["Offset of field: GhosttyDeviceAttributes::secondary"]
        [::std::mem::offset_of!(GhosttyDeviceAttributes, secondary) - 144usize];
    ["Offset of field: GhosttyDeviceAttributes::tertiary"]
        [::std::mem::offset_of!(GhosttyDeviceAttributes, tertiary) - 152usize];
};
impl Default for GhosttyDeviceAttributes {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Terminal window gained focus"]
pub const GhosttyFocusEvent_GHOSTTY_FOCUS_GAINED: GhosttyFocusEvent = 0;
#[doc = " Terminal window lost focus"]
pub const GhosttyFocusEvent_GHOSTTY_FOCUS_LOST: GhosttyFocusEvent = 1;
#[doc = " Focus event types for focus reporting mode (mode 1004)."]
pub type GhosttyFocusEvent = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Encode a focus event into a terminal escape sequence.\n\n Encodes a focus gained (CSI I) or focus lost (CSI O) report into the\n provided buffer.\n\n If the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE\n and writes the required buffer size to @p out_written. The caller can\n then retry with a sufficiently sized buffer.\n\n @param event The focus event to encode\n @param buf Output buffer to write the encoded sequence into (may be NULL)\n @param buf_len Size of the output buffer in bytes\n @param[out] out_written On success, the number of bytes written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer\n         is too small"]
    pub fn ghostty_focus_encode(
        event: GhosttyFocusEvent,
        buf: *mut ::std::os::raw::c_char,
        buf_len: usize,
        out_written: *mut usize,
    ) -> GhosttyResult;
}
#[doc = " A packed 16-bit terminal mode.\n\n Encodes a mode value (bits 0–14) and an ANSI flag (bit 15) into a\n single 16-bit integer. Use the inline helper functions to construct\n and inspect modes rather than manipulating bits directly."]
pub type GhosttyMode = u16;
#[doc = " Mode is not recognized"]
pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_NOT_RECOGNIZED: GhosttyModeReportState = 0;
#[doc = " Mode is set (enabled)"]
pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_SET: GhosttyModeReportState = 1;
#[doc = " Mode is reset (disabled)"]
pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_RESET: GhosttyModeReportState = 2;
#[doc = " Mode is permanently set"]
pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_PERMANENTLY_SET: GhosttyModeReportState = 3;
#[doc = " Mode is permanently reset"]
pub const GhosttyModeReportState_GHOSTTY_MODE_REPORT_PERMANENTLY_RESET: GhosttyModeReportState = 4;
#[doc = " DECRPM report state values.\n\n These correspond to the Ps2 parameter in a DECRPM response\n sequence (CSI ? Ps1 ; Ps2 $ y)."]
pub type GhosttyModeReportState = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Encode a DECRPM (DEC Private Mode Report) response sequence.\n\n Writes a mode report escape sequence into the provided buffer.\n The generated sequence has the form:\n - DEC private mode: CSI ? Ps1 ; Ps2 $ y\n - ANSI mode:        CSI Ps1 ; Ps2 $ y\n\n If the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE\n and writes the required buffer size to @p out_written. The caller can\n then retry with a sufficiently sized buffer.\n\n @param mode The mode identifying the mode to report on\n @param state The report state for this mode\n @param buf Output buffer to write the encoded sequence into (may be NULL)\n @param buf_len Size of the output buffer in bytes\n @param[out] out_written On success, the number of bytes written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer\n         is too small"]
    pub fn ghostty_mode_report_encode(
        mode: GhosttyMode,
        state: GhosttyModeReportState,
        buf: *mut ::std::os::raw::c_char,
        buf_len: usize,
        out_written: *mut usize,
    ) -> GhosttyResult;
}
#[doc = " In-band size report (mode 2048): ESC [ 48 ; rows ; cols ; height ; width t"]
pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_MODE_2048: GhosttySizeReportStyle = 0;
#[doc = " XTWINOPS text area size in pixels: ESC [ 4 ; height ; width t"]
pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_CSI_14_T: GhosttySizeReportStyle = 1;
#[doc = " XTWINOPS cell size in pixels: ESC [ 6 ; height ; width t"]
pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_CSI_16_T: GhosttySizeReportStyle = 2;
#[doc = " XTWINOPS text area size in characters: ESC [ 8 ; rows ; cols t"]
pub const GhosttySizeReportStyle_GHOSTTY_SIZE_REPORT_CSI_18_T: GhosttySizeReportStyle = 3;
#[doc = " Size report style.\n\n Determines the output format for the terminal size report."]
pub type GhosttySizeReportStyle = ::std::os::raw::c_uint;
#[doc = " Terminal size information for encoding size reports."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttySizeReportSize {
    #[doc = " Terminal row count in cells."]
    pub rows: u16,
    #[doc = " Terminal column count in cells."]
    pub columns: u16,
    #[doc = " Width of a single terminal cell in pixels."]
    pub cell_width: u32,
    #[doc = " Height of a single terminal cell in pixels."]
    pub cell_height: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttySizeReportSize"][::std::mem::size_of::<GhosttySizeReportSize>() - 12usize];
    ["Alignment of GhosttySizeReportSize"]
        [::std::mem::align_of::<GhosttySizeReportSize>() - 4usize];
    ["Offset of field: GhosttySizeReportSize::rows"]
        [::std::mem::offset_of!(GhosttySizeReportSize, rows) - 0usize];
    ["Offset of field: GhosttySizeReportSize::columns"]
        [::std::mem::offset_of!(GhosttySizeReportSize, columns) - 2usize];
    ["Offset of field: GhosttySizeReportSize::cell_width"]
        [::std::mem::offset_of!(GhosttySizeReportSize, cell_width) - 4usize];
    ["Offset of field: GhosttySizeReportSize::cell_height"]
        [::std::mem::offset_of!(GhosttySizeReportSize, cell_height) - 8usize];
};
unsafe extern "C" {
    #[doc = " Encode a terminal size report into an escape sequence.\n\n Encodes a size report in the format specified by @p style into the\n provided buffer.\n\n If the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE\n and writes the required buffer size to @p out_written. The caller can\n then retry with a sufficiently sized buffer.\n\n @param style The size report format to encode\n @param size Terminal size information\n @param buf Output buffer to write the encoded sequence into (may be NULL)\n @param buf_len Size of the output buffer in bytes\n @param[out] out_written On success, the number of bytes written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if the buffer\n         is too small"]
    pub fn ghostty_size_report_encode(
        style: GhosttySizeReportStyle,
        size: GhosttySizeReportSize,
        buf: *mut ::std::os::raw::c_char,
        buf_len: usize,
        out_written: *mut usize,
    ) -> GhosttyResult;
}
#[doc = " Opaque cell value.\n\n Represents a single terminal cell. The internal layout is opaque and\n must be queried via ghostty_cell_get(). Obtain cell values from\n terminal query APIs.\n\n @ingroup screen"]
pub type GhosttyCell = u64;
#[doc = " Opaque row value.\n\n Represents a single terminal row. The internal layout is opaque and\n must be queried via ghostty_row_get(). Obtain row values from\n terminal query APIs.\n\n @ingroup screen"]
pub type GhosttyRow = u64;
#[doc = " A single codepoint (may be zero for empty)."]
pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_CODEPOINT: GhosttyCellContentTag = 0;
#[doc = " A codepoint that is part of a multi-codepoint grapheme cluster."]
pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_CODEPOINT_GRAPHEME: GhosttyCellContentTag = 1;
#[doc = " No text; background color from palette."]
pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE: GhosttyCellContentTag = 2;
#[doc = " No text; background color as RGB."]
pub const GhosttyCellContentTag_GHOSTTY_CELL_CONTENT_BG_COLOR_RGB: GhosttyCellContentTag = 3;
#[doc = " Cell content tag.\n\n Describes what kind of content a cell holds.\n\n @ingroup screen"]
pub type GhosttyCellContentTag = ::std::os::raw::c_uint;
#[doc = " Not a wide character, cell width 1."]
pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_NARROW: GhosttyCellWide = 0;
#[doc = " Wide character, cell width 2."]
pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_WIDE: GhosttyCellWide = 1;
#[doc = " Spacer after wide character. Do not render."]
pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_SPACER_TAIL: GhosttyCellWide = 2;
#[doc = " Spacer at end of soft-wrapped line for a wide character."]
pub const GhosttyCellWide_GHOSTTY_CELL_WIDE_SPACER_HEAD: GhosttyCellWide = 3;
#[doc = " Cell wide property.\n\n Describes the width behavior of a cell.\n\n @ingroup screen"]
pub type GhosttyCellWide = ::std::os::raw::c_uint;
#[doc = " Regular output content, such as command output."]
pub const GhosttyCellSemanticContent_GHOSTTY_CELL_SEMANTIC_OUTPUT: GhosttyCellSemanticContent = 0;
#[doc = " Content that is part of user input."]
pub const GhosttyCellSemanticContent_GHOSTTY_CELL_SEMANTIC_INPUT: GhosttyCellSemanticContent = 1;
#[doc = " Content that is part of a shell prompt."]
pub const GhosttyCellSemanticContent_GHOSTTY_CELL_SEMANTIC_PROMPT: GhosttyCellSemanticContent = 2;
#[doc = " Semantic content type of a cell.\n\n Set by semantic prompt sequences (OSC 133) to distinguish between\n command output, user input, and shell prompt text.\n\n @ingroup screen"]
pub type GhosttyCellSemanticContent = ::std::os::raw::c_uint;
#[doc = " Invalid data type. Never results in any data extraction."]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_INVALID: GhosttyCellData = 0;
#[doc = " The codepoint of the cell (0 if empty or bg-color-only).\n\n Output type: uint32_t *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_CODEPOINT: GhosttyCellData = 1;
#[doc = " The content tag describing what kind of content is in the cell.\n\n Output type: GhosttyCellContentTag *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_CONTENT_TAG: GhosttyCellData = 2;
#[doc = " The wide property of the cell.\n\n Output type: GhosttyCellWide *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_WIDE: GhosttyCellData = 3;
#[doc = " Whether the cell has text to render.\n\n Output type: bool *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_HAS_TEXT: GhosttyCellData = 4;
#[doc = " Whether the cell has non-default styling.\n\n Output type: bool *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_HAS_STYLING: GhosttyCellData = 5;
#[doc = " The style ID for the cell (for use with style lookups).\n\n Output type: uint16_t *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_STYLE_ID: GhosttyCellData = 6;
#[doc = " Whether the cell has a hyperlink.\n\n Output type: bool *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_HAS_HYPERLINK: GhosttyCellData = 7;
#[doc = " Whether the cell is protected.\n\n Output type: bool *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_PROTECTED: GhosttyCellData = 8;
#[doc = " The semantic content type of the cell (from OSC 133).\n\n Output type: GhosttyCellSemanticContent *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_SEMANTIC_CONTENT: GhosttyCellData = 9;
#[doc = " The palette index for the cell's background color.\n Only valid when content_tag is GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE.\n\n Output type: GhosttyColorPaletteIndex *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_COLOR_PALETTE: GhosttyCellData = 10;
#[doc = " The RGB value for the cell's background color.\n Only valid when content_tag is GHOSTTY_CELL_CONTENT_BG_COLOR_RGB.\n\n Output type: GhosttyColorRgb *"]
pub const GhosttyCellData_GHOSTTY_CELL_DATA_COLOR_RGB: GhosttyCellData = 11;
#[doc = " Cell data types.\n\n These values specify what type of data to extract from a cell\n using `ghostty_cell_get`.\n\n @ingroup screen"]
pub type GhosttyCellData = ::std::os::raw::c_uint;
#[doc = " No prompt cells in this row."]
pub const GhosttyRowSemanticPrompt_GHOSTTY_ROW_SEMANTIC_NONE: GhosttyRowSemanticPrompt = 0;
#[doc = " Prompt cells exist and this is a primary prompt line."]
pub const GhosttyRowSemanticPrompt_GHOSTTY_ROW_SEMANTIC_PROMPT: GhosttyRowSemanticPrompt = 1;
#[doc = " Prompt cells exist and this is a continuation line."]
pub const GhosttyRowSemanticPrompt_GHOSTTY_ROW_SEMANTIC_PROMPT_CONTINUATION:
    GhosttyRowSemanticPrompt = 2;
#[doc = " Row semantic prompt state.\n\n Indicates whether any cells in a row are part of a shell prompt,\n as reported by OSC 133 sequences.\n\n @ingroup screen"]
pub type GhosttyRowSemanticPrompt = ::std::os::raw::c_uint;
#[doc = " Invalid data type. Never results in any data extraction."]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_INVALID: GhosttyRowData = 0;
#[doc = " Whether this row is soft-wrapped.\n\n Output type: bool *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_WRAP: GhosttyRowData = 1;
#[doc = " Whether this row is a continuation of a soft-wrapped row.\n\n Output type: bool *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_WRAP_CONTINUATION: GhosttyRowData = 2;
#[doc = " Whether any cells in this row have grapheme clusters.\n\n Output type: bool *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_GRAPHEME: GhosttyRowData = 3;
#[doc = " Whether any cells in this row have styling (may have false positives).\n\n Output type: bool *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_STYLED: GhosttyRowData = 4;
#[doc = " Whether any cells in this row have hyperlinks (may have false positives).\n\n Output type: bool *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_HYPERLINK: GhosttyRowData = 5;
#[doc = " The semantic prompt state of this row.\n\n Output type: GhosttyRowSemanticPrompt *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_SEMANTIC_PROMPT: GhosttyRowData = 6;
#[doc = " Whether this row contains a Kitty virtual placeholder.\n\n Output type: bool *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_KITTY_VIRTUAL_PLACEHOLDER: GhosttyRowData = 7;
#[doc = " Whether this row is dirty and requires a redraw.\n\n Output type: bool *"]
pub const GhosttyRowData_GHOSTTY_ROW_DATA_DIRTY: GhosttyRowData = 8;
#[doc = " Row data types.\n\n These values specify what type of data to extract from a row\n using `ghostty_row_get`.\n\n @ingroup screen"]
pub type GhosttyRowData = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Get data from a cell.\n\n Extracts typed data from the given cell based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid data types and output types are documented\n in the `GhosttyCellData` enum.\n\n @param cell The cell value\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the\n         data type is invalid\n\n @ingroup screen"]
    pub fn ghostty_cell_get(
        cell: GhosttyCell,
        data: GhosttyCellData,
        out: *mut ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get data from a row.\n\n Extracts typed data from the given row based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid data types and output types are documented\n in the `GhosttyRowData` enum.\n\n @param row The row value\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the\n         data type is invalid\n\n @ingroup screen"]
    pub fn ghostty_row_get(
        row: GhosttyRow,
        data: GhosttyRowData,
        out: *mut ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
#[doc = " Style identifier type.\n\n Used to look up the full style from a grid reference.\n Obtain this from a cell via GHOSTTY_CELL_DATA_STYLE_ID.\n\n @ingroup style"]
pub type GhosttyStyleId = u16;
pub const GhosttyStyleColorTag_GHOSTTY_STYLE_COLOR_NONE: GhosttyStyleColorTag = 0;
pub const GhosttyStyleColorTag_GHOSTTY_STYLE_COLOR_PALETTE: GhosttyStyleColorTag = 1;
pub const GhosttyStyleColorTag_GHOSTTY_STYLE_COLOR_RGB: GhosttyStyleColorTag = 2;
#[doc = " Style color tags.\n\n These values identify the type of color in a style color.\n Use the tag to determine which field in the color value union to access.\n\n @ingroup style"]
pub type GhosttyStyleColorTag = ::std::os::raw::c_uint;
#[doc = " Style color value union.\n\n Use the tag to determine which field is active.\n\n @ingroup style"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union GhosttyStyleColorValue {
    pub palette: GhosttyColorPaletteIndex,
    pub rgb: GhosttyColorRgb,
    pub _padding: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyStyleColorValue"][::std::mem::size_of::<GhosttyStyleColorValue>() - 8usize];
    ["Alignment of GhosttyStyleColorValue"]
        [::std::mem::align_of::<GhosttyStyleColorValue>() - 8usize];
    ["Offset of field: GhosttyStyleColorValue::palette"]
        [::std::mem::offset_of!(GhosttyStyleColorValue, palette) - 0usize];
    ["Offset of field: GhosttyStyleColorValue::rgb"]
        [::std::mem::offset_of!(GhosttyStyleColorValue, rgb) - 0usize];
    ["Offset of field: GhosttyStyleColorValue::_padding"]
        [::std::mem::offset_of!(GhosttyStyleColorValue, _padding) - 0usize];
};
impl Default for GhosttyStyleColorValue {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Style color (tagged union).\n\n A color used in a style attribute. Can be unset (none), a palette\n index, or a direct RGB value.\n\n @ingroup style"]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GhosttyStyleColor {
    pub tag: GhosttyStyleColorTag,
    pub value: GhosttyStyleColorValue,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyStyleColor"][::std::mem::size_of::<GhosttyStyleColor>() - 16usize];
    ["Alignment of GhosttyStyleColor"][::std::mem::align_of::<GhosttyStyleColor>() - 8usize];
    ["Offset of field: GhosttyStyleColor::tag"]
        [::std::mem::offset_of!(GhosttyStyleColor, tag) - 0usize];
    ["Offset of field: GhosttyStyleColor::value"]
        [::std::mem::offset_of!(GhosttyStyleColor, value) - 8usize];
};
impl Default for GhosttyStyleColor {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Terminal cell style.\n\n Describes the complete visual style for a terminal cell, including\n foreground, background, and underline colors, as well as text\n decoration flags. The underline field uses the same values as\n GhosttySgrUnderline.\n\n This is a sized struct. Use GHOSTTY_INIT_SIZED() to initialize it.\n\n @ingroup style"]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GhosttyStyle {
    pub size: usize,
    pub fg_color: GhosttyStyleColor,
    pub bg_color: GhosttyStyleColor,
    pub underline_color: GhosttyStyleColor,
    pub bold: bool,
    pub italic: bool,
    pub faint: bool,
    pub blink: bool,
    pub inverse: bool,
    pub invisible: bool,
    pub strikethrough: bool,
    pub overline: bool,
    #[doc = "< One of GHOSTTY_SGR_UNDERLINE_* values"]
    pub underline: ::std::os::raw::c_int,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyStyle"][::std::mem::size_of::<GhosttyStyle>() - 72usize];
    ["Alignment of GhosttyStyle"][::std::mem::align_of::<GhosttyStyle>() - 8usize];
    ["Offset of field: GhosttyStyle::size"][::std::mem::offset_of!(GhosttyStyle, size) - 0usize];
    ["Offset of field: GhosttyStyle::fg_color"]
        [::std::mem::offset_of!(GhosttyStyle, fg_color) - 8usize];
    ["Offset of field: GhosttyStyle::bg_color"]
        [::std::mem::offset_of!(GhosttyStyle, bg_color) - 24usize];
    ["Offset of field: GhosttyStyle::underline_color"]
        [::std::mem::offset_of!(GhosttyStyle, underline_color) - 40usize];
    ["Offset of field: GhosttyStyle::bold"][::std::mem::offset_of!(GhosttyStyle, bold) - 56usize];
    ["Offset of field: GhosttyStyle::italic"]
        [::std::mem::offset_of!(GhosttyStyle, italic) - 57usize];
    ["Offset of field: GhosttyStyle::faint"][::std::mem::offset_of!(GhosttyStyle, faint) - 58usize];
    ["Offset of field: GhosttyStyle::blink"][::std::mem::offset_of!(GhosttyStyle, blink) - 59usize];
    ["Offset of field: GhosttyStyle::inverse"]
        [::std::mem::offset_of!(GhosttyStyle, inverse) - 60usize];
    ["Offset of field: GhosttyStyle::invisible"]
        [::std::mem::offset_of!(GhosttyStyle, invisible) - 61usize];
    ["Offset of field: GhosttyStyle::strikethrough"]
        [::std::mem::offset_of!(GhosttyStyle, strikethrough) - 62usize];
    ["Offset of field: GhosttyStyle::overline"]
        [::std::mem::offset_of!(GhosttyStyle, overline) - 63usize];
    ["Offset of field: GhosttyStyle::underline"]
        [::std::mem::offset_of!(GhosttyStyle, underline) - 64usize];
};
impl Default for GhosttyStyle {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
unsafe extern "C" {
    #[doc = " Get the default style.\n\n Initializes the style to the default values (no colors, no flags).\n\n @param style Pointer to the style to initialize\n\n @ingroup style"]
    pub fn ghostty_style_default(style: *mut GhosttyStyle);
}
unsafe extern "C" {
    #[doc = " Check if a style is the default style.\n\n Returns true if all colors are unset and all flags are off.\n\n @param style Pointer to the style to check\n @return true if the style is the default style\n\n @ingroup style"]
    pub fn ghostty_style_is_default(style: *const GhosttyStyle) -> bool;
}
#[doc = " A resolved reference to a terminal cell position.\n\n This is a sized struct. Use GHOSTTY_INIT_SIZED() to initialize it.\n\n @ingroup grid_ref"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyGridRef {
    pub size: usize,
    pub node: *mut ::std::os::raw::c_void,
    pub x: u16,
    pub y: u16,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyGridRef"][::std::mem::size_of::<GhosttyGridRef>() - 24usize];
    ["Alignment of GhosttyGridRef"][::std::mem::align_of::<GhosttyGridRef>() - 8usize];
    ["Offset of field: GhosttyGridRef::size"]
        [::std::mem::offset_of!(GhosttyGridRef, size) - 0usize];
    ["Offset of field: GhosttyGridRef::node"]
        [::std::mem::offset_of!(GhosttyGridRef, node) - 8usize];
    ["Offset of field: GhosttyGridRef::x"][::std::mem::offset_of!(GhosttyGridRef, x) - 16usize];
    ["Offset of field: GhosttyGridRef::y"][::std::mem::offset_of!(GhosttyGridRef, y) - 18usize];
};
impl Default for GhosttyGridRef {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
unsafe extern "C" {
    #[doc = " Get the cell from a grid reference.\n\n @param ref Pointer to the grid reference\n @param[out] out_cell On success, set to the cell at the ref's position (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL\n\n @ingroup grid_ref"]
    pub fn ghostty_grid_ref_cell(
        ref_: *const GhosttyGridRef,
        out_cell: *mut GhosttyCell,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get the row from a grid reference.\n\n @param ref Pointer to the grid reference\n @param[out] out_row On success, set to the row at the ref's position (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL\n\n @ingroup grid_ref"]
    pub fn ghostty_grid_ref_row(
        ref_: *const GhosttyGridRef,
        out_row: *mut GhosttyRow,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get the grapheme cluster codepoints for the cell at the grid reference's\n position.\n\n Writes the full grapheme cluster (the cell's primary codepoint followed by\n any combining codepoints) into the provided buffer. If the cell has no text,\n out_len is set to 0 and GHOSTTY_SUCCESS is returned.\n\n If the buffer is too small (or NULL), the function returns\n GHOSTTY_OUT_OF_SPACE and writes the required number of codepoints to\n out_len. The caller can then retry with a sufficiently sized buffer.\n\n @param ref Pointer to the grid reference\n @param buf Output buffer of uint32_t codepoints (may be NULL)\n @param buf_len Number of uint32_t elements in the buffer\n @param[out] out_len On success, the number of codepoints written. On\n             GHOSTTY_OUT_OF_SPACE, the required buffer size in codepoints.\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL, GHOSTTY_OUT_OF_SPACE if the buffer is too small\n\n @ingroup grid_ref"]
    pub fn ghostty_grid_ref_graphemes(
        ref_: *const GhosttyGridRef,
        buf: *mut u32,
        buf_len: usize,
        out_len: *mut usize,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get the style of the cell at the grid reference's position.\n\n @param ref Pointer to the grid reference\n @param[out] out_style On success, set to the cell's style (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the ref's\n         node is NULL\n\n @ingroup grid_ref"]
    pub fn ghostty_grid_ref_style(
        ref_: *const GhosttyGridRef,
        out_style: *mut GhosttyStyle,
    ) -> GhosttyResult;
}
#[doc = " A coordinate in the terminal grid.\n\n @ingroup point"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyPointCoordinate {
    #[doc = " Column (0-indexed)."]
    pub x: u16,
    #[doc = " Row (0-indexed). May exceed page size for screen/history tags."]
    pub y: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyPointCoordinate"][::std::mem::size_of::<GhosttyPointCoordinate>() - 8usize];
    ["Alignment of GhosttyPointCoordinate"]
        [::std::mem::align_of::<GhosttyPointCoordinate>() - 4usize];
    ["Offset of field: GhosttyPointCoordinate::x"]
        [::std::mem::offset_of!(GhosttyPointCoordinate, x) - 0usize];
    ["Offset of field: GhosttyPointCoordinate::y"]
        [::std::mem::offset_of!(GhosttyPointCoordinate, y) - 4usize];
};
#[doc = " Active area where the cursor can move."]
pub const GhosttyPointTag_GHOSTTY_POINT_TAG_ACTIVE: GhosttyPointTag = 0;
#[doc = " Visible viewport (changes when scrolled)."]
pub const GhosttyPointTag_GHOSTTY_POINT_TAG_VIEWPORT: GhosttyPointTag = 1;
#[doc = " Full screen including scrollback."]
pub const GhosttyPointTag_GHOSTTY_POINT_TAG_SCREEN: GhosttyPointTag = 2;
#[doc = " Scrollback history only (before active area)."]
pub const GhosttyPointTag_GHOSTTY_POINT_TAG_HISTORY: GhosttyPointTag = 3;
#[doc = " Point reference tag.\n\n Determines which coordinate system a point uses.\n\n @ingroup point"]
pub type GhosttyPointTag = ::std::os::raw::c_uint;
#[doc = " Point value union.\n\n @ingroup point"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union GhosttyPointValue {
    #[doc = " Coordinate (used for all tag variants)."]
    pub coordinate: GhosttyPointCoordinate,
    #[doc = " Padding for ABI compatibility. Do not use."]
    pub _padding: [u64; 2usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyPointValue"][::std::mem::size_of::<GhosttyPointValue>() - 16usize];
    ["Alignment of GhosttyPointValue"][::std::mem::align_of::<GhosttyPointValue>() - 8usize];
    ["Offset of field: GhosttyPointValue::coordinate"]
        [::std::mem::offset_of!(GhosttyPointValue, coordinate) - 0usize];
    ["Offset of field: GhosttyPointValue::_padding"]
        [::std::mem::offset_of!(GhosttyPointValue, _padding) - 0usize];
};
impl Default for GhosttyPointValue {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Tagged union for a point in the terminal grid.\n\n @ingroup point"]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GhosttyPoint {
    pub tag: GhosttyPointTag,
    pub value: GhosttyPointValue,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyPoint"][::std::mem::size_of::<GhosttyPoint>() - 24usize];
    ["Alignment of GhosttyPoint"][::std::mem::align_of::<GhosttyPoint>() - 8usize];
    ["Offset of field: GhosttyPoint::tag"][::std::mem::offset_of!(GhosttyPoint, tag) - 0usize];
    ["Offset of field: GhosttyPoint::value"][::std::mem::offset_of!(GhosttyPoint, value) - 8usize];
};
impl Default for GhosttyPoint {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyTerminal {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a terminal instance.\n\n @ingroup terminal"]
pub type GhosttyTerminal_ptr = *mut GhosttyTerminal;
#[doc = " Terminal initialization options.\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyTerminalOptions {
    #[doc = " Terminal width in cells. Must be greater than zero."]
    pub cols: u16,
    #[doc = " Terminal height in cells. Must be greater than zero."]
    pub rows: u16,
    #[doc = " Maximum number of lines to keep in scrollback history."]
    pub max_scrollback: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyTerminalOptions"][::std::mem::size_of::<GhosttyTerminalOptions>() - 16usize];
    ["Alignment of GhosttyTerminalOptions"]
        [::std::mem::align_of::<GhosttyTerminalOptions>() - 8usize];
    ["Offset of field: GhosttyTerminalOptions::cols"]
        [::std::mem::offset_of!(GhosttyTerminalOptions, cols) - 0usize];
    ["Offset of field: GhosttyTerminalOptions::rows"]
        [::std::mem::offset_of!(GhosttyTerminalOptions, rows) - 2usize];
    ["Offset of field: GhosttyTerminalOptions::max_scrollback"]
        [::std::mem::offset_of!(GhosttyTerminalOptions, max_scrollback) - 8usize];
};
#[doc = " Scroll to the top of the scrollback."]
pub const GhosttyTerminalScrollViewportTag_GHOSTTY_SCROLL_VIEWPORT_TOP:
    GhosttyTerminalScrollViewportTag = 0;
#[doc = " Scroll to the bottom (active area)."]
pub const GhosttyTerminalScrollViewportTag_GHOSTTY_SCROLL_VIEWPORT_BOTTOM:
    GhosttyTerminalScrollViewportTag = 1;
#[doc = " Scroll by a delta amount (up is negative)."]
pub const GhosttyTerminalScrollViewportTag_GHOSTTY_SCROLL_VIEWPORT_DELTA:
    GhosttyTerminalScrollViewportTag = 2;
#[doc = " Scroll viewport behavior tag.\n\n @ingroup terminal"]
pub type GhosttyTerminalScrollViewportTag = ::std::os::raw::c_uint;
#[doc = " Scroll viewport value.\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union GhosttyTerminalScrollViewportValue {
    #[doc = " Scroll delta (only used with GHOSTTY_SCROLL_VIEWPORT_DELTA). Up is negative."]
    pub delta: isize,
    #[doc = " Padding for ABI compatibility. Do not use."]
    pub _padding: [u64; 2usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyTerminalScrollViewportValue"]
        [::std::mem::size_of::<GhosttyTerminalScrollViewportValue>() - 16usize];
    ["Alignment of GhosttyTerminalScrollViewportValue"]
        [::std::mem::align_of::<GhosttyTerminalScrollViewportValue>() - 8usize];
    ["Offset of field: GhosttyTerminalScrollViewportValue::delta"]
        [::std::mem::offset_of!(GhosttyTerminalScrollViewportValue, delta) - 0usize];
    ["Offset of field: GhosttyTerminalScrollViewportValue::_padding"]
        [::std::mem::offset_of!(GhosttyTerminalScrollViewportValue, _padding) - 0usize];
};
impl Default for GhosttyTerminalScrollViewportValue {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " Tagged union for scroll viewport behavior.\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GhosttyTerminalScrollViewport {
    pub tag: GhosttyTerminalScrollViewportTag,
    pub value: GhosttyTerminalScrollViewportValue,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyTerminalScrollViewport"]
        [::std::mem::size_of::<GhosttyTerminalScrollViewport>() - 24usize];
    ["Alignment of GhosttyTerminalScrollViewport"]
        [::std::mem::align_of::<GhosttyTerminalScrollViewport>() - 8usize];
    ["Offset of field: GhosttyTerminalScrollViewport::tag"]
        [::std::mem::offset_of!(GhosttyTerminalScrollViewport, tag) - 0usize];
    ["Offset of field: GhosttyTerminalScrollViewport::value"]
        [::std::mem::offset_of!(GhosttyTerminalScrollViewport, value) - 8usize];
};
impl Default for GhosttyTerminalScrollViewport {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " The primary (normal) screen."]
pub const GhosttyTerminalScreen_GHOSTTY_TERMINAL_SCREEN_PRIMARY: GhosttyTerminalScreen = 0;
#[doc = " The alternate screen."]
pub const GhosttyTerminalScreen_GHOSTTY_TERMINAL_SCREEN_ALTERNATE: GhosttyTerminalScreen = 1;
#[doc = " Terminal screen identifier.\n\n Identifies which screen buffer is active in the terminal.\n\n @ingroup terminal"]
pub type GhosttyTerminalScreen = ::std::os::raw::c_uint;
#[doc = " Scrollbar state for the terminal viewport.\n\n Represents the scrollable area dimensions needed to render a scrollbar.\n\n @ingroup terminal"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyTerminalScrollbar {
    #[doc = " Total size of the scrollable area in rows."]
    pub total: u64,
    #[doc = " Offset into the total area that the viewport is at."]
    pub offset: u64,
    #[doc = " Length of the visible area in rows."]
    pub len: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyTerminalScrollbar"]
        [::std::mem::size_of::<GhosttyTerminalScrollbar>() - 24usize];
    ["Alignment of GhosttyTerminalScrollbar"]
        [::std::mem::align_of::<GhosttyTerminalScrollbar>() - 8usize];
    ["Offset of field: GhosttyTerminalScrollbar::total"]
        [::std::mem::offset_of!(GhosttyTerminalScrollbar, total) - 0usize];
    ["Offset of field: GhosttyTerminalScrollbar::offset"]
        [::std::mem::offset_of!(GhosttyTerminalScrollbar, offset) - 8usize];
    ["Offset of field: GhosttyTerminalScrollbar::len"]
        [::std::mem::offset_of!(GhosttyTerminalScrollbar, len) - 16usize];
};
#[doc = " Callback function type for bell.\n\n Called when the terminal receives a BEL character (0x07).\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n\n @ingroup terminal"]
pub type GhosttyTerminalBellFn = ::std::option::Option<
    unsafe extern "C" fn(terminal: GhosttyTerminal_ptr, userdata: *mut ::std::os::raw::c_void),
>;
#[doc = " Callback function type for color scheme queries (CSI ? 996 n).\n\n Called when the terminal receives a color scheme device status report\n query. Return true and fill *out_scheme with the current color scheme,\n or return false to silently ignore the query.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param[out] out_scheme Pointer to store the current color scheme\n @return true if the color scheme was filled, false to ignore the query\n\n @ingroup terminal"]
pub type GhosttyTerminalColorSchemeFn = ::std::option::Option<
    unsafe extern "C" fn(
        terminal: GhosttyTerminal_ptr,
        userdata: *mut ::std::os::raw::c_void,
        out_scheme: *mut GhosttyColorScheme,
    ) -> bool,
>;
#[doc = " Callback function type for device attributes queries (DA1/DA2/DA3).\n\n Called when the terminal receives a device attributes query (CSI c,\n CSI > c, or CSI = c). Return true and fill *out_attrs with the\n response data, or return false to silently ignore the query.\n\n The terminal uses whichever sub-struct (primary, secondary, tertiary)\n matches the request type, but all three should be filled for simplicity.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param[out] out_attrs Pointer to store the device attributes response\n @return true if attributes were filled, false to ignore the query\n\n @ingroup terminal"]
pub type GhosttyTerminalDeviceAttributesFn = ::std::option::Option<
    unsafe extern "C" fn(
        terminal: GhosttyTerminal_ptr,
        userdata: *mut ::std::os::raw::c_void,
        out_attrs: *mut GhosttyDeviceAttributes,
    ) -> bool,
>;
#[doc = " Callback function type for enquiry (ENQ, 0x05).\n\n Called when the terminal receives an ENQ character. Return the\n response bytes as a GhosttyString. The memory must remain valid\n until the callback returns. Return a zero-length string to send\n no response.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @return The response bytes to write back to the pty\n\n @ingroup terminal"]
pub type GhosttyTerminalEnquiryFn = ::std::option::Option<
    unsafe extern "C" fn(
        terminal: GhosttyTerminal_ptr,
        userdata: *mut ::std::os::raw::c_void,
    ) -> GhosttyString,
>;
#[doc = " Callback function type for size queries (XTWINOPS).\n\n Called in response to XTWINOPS size queries (CSI 14/16/18 t).\n Return true and fill *out_size with the current terminal geometry,\n or return false to silently ignore the query.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param[out] out_size Pointer to store the terminal size information\n @return true if size was filled, false to ignore the query\n\n @ingroup terminal"]
pub type GhosttyTerminalSizeFn = ::std::option::Option<
    unsafe extern "C" fn(
        terminal: GhosttyTerminal_ptr,
        userdata: *mut ::std::os::raw::c_void,
        out_size: *mut GhosttySizeReportSize,
    ) -> bool,
>;
#[doc = " Callback function type for title_changed.\n\n Called when the terminal title changes via escape sequences\n (e.g. OSC 0 or OSC 2). The new title can be queried from the\n terminal after the callback returns.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n\n @ingroup terminal"]
pub type GhosttyTerminalTitleChangedFn = ::std::option::Option<
    unsafe extern "C" fn(terminal: GhosttyTerminal_ptr, userdata: *mut ::std::os::raw::c_void),
>;
#[doc = " Callback function type for write_pty.\n\n Called when the terminal needs to write data back to the pty, for\n example in response to a device status report or mode query. The\n data is only valid for the duration of the call; callers must copy\n it if it needs to persist.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @param data Pointer to the response bytes\n @param len Length of the response in bytes\n\n @ingroup terminal"]
pub type GhosttyTerminalWritePtyFn = ::std::option::Option<
    unsafe extern "C" fn(
        terminal: GhosttyTerminal_ptr,
        userdata: *mut ::std::os::raw::c_void,
        data: *const u8,
        len: usize,
    ),
>;
#[doc = " Callback function type for XTVERSION.\n\n Called when the terminal receives an XTVERSION query (CSI > q).\n Return the version string (e.g. \"myterm 1.0\") as a GhosttyString.\n The memory must remain valid until the callback returns. Return a\n zero-length string to report the default \"libghostty\" version.\n\n @param terminal The terminal handle\n @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA\n @return The version string to report\n\n @ingroup terminal"]
pub type GhosttyTerminalXtversionFn = ::std::option::Option<
    unsafe extern "C" fn(
        terminal: GhosttyTerminal_ptr,
        userdata: *mut ::std::os::raw::c_void,
    ) -> GhosttyString,
>;
#[doc = " Opaque userdata pointer passed to all callbacks.\n\n Input type: void*"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_USERDATA: GhosttyTerminalOption = 0;
#[doc = " Callback invoked when the terminal needs to write data back\n to the pty (e.g. in response to a DECRQM query or device\n status report). Set to NULL to ignore such sequences.\n\n Input type: GhosttyTerminalWritePtyFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_WRITE_PTY: GhosttyTerminalOption = 1;
#[doc = " Callback invoked when the terminal receives a BEL character\n (0x07). Set to NULL to ignore bell events.\n\n Input type: GhosttyTerminalBellFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_BELL: GhosttyTerminalOption = 2;
#[doc = " Callback invoked when the terminal receives an ENQ character\n (0x05). Set to NULL to send no response.\n\n Input type: GhosttyTerminalEnquiryFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_ENQUIRY: GhosttyTerminalOption = 3;
#[doc = " Callback invoked when the terminal receives an XTVERSION query\n (CSI > q). Set to NULL to report the default \"libghostty\" string.\n\n Input type: GhosttyTerminalXtversionFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_XTVERSION: GhosttyTerminalOption = 4;
#[doc = " Callback invoked when the terminal title changes via escape\n sequences (e.g. OSC 0 or OSC 2). Set to NULL to ignore title\n change events.\n\n Input type: GhosttyTerminalTitleChangedFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_TITLE_CHANGED: GhosttyTerminalOption = 5;
#[doc = " Callback invoked in response to XTWINOPS size queries\n (CSI 14/16/18 t). Set to NULL to silently ignore size queries.\n\n Input type: GhosttyTerminalSizeFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_SIZE: GhosttyTerminalOption = 6;
#[doc = " Callback invoked in response to a color scheme device status\n report query (CSI ? 996 n). Return true and fill the out pointer\n to report the current scheme, or return false to silently ignore.\n Set to NULL to ignore color scheme queries.\n\n Input type: GhosttyTerminalColorSchemeFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_COLOR_SCHEME: GhosttyTerminalOption = 7;
#[doc = " Callback invoked in response to a device attributes query\n (CSI c, CSI > c, or CSI = c). Return true and fill the out\n pointer with response data, or return false to silently ignore.\n Set to NULL to ignore device attributes queries.\n\n Input type: GhosttyTerminalDeviceAttributesFn"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_DEVICE_ATTRIBUTES: GhosttyTerminalOption = 8;
#[doc = " Set the terminal title manually.\n\n The string data is copied into the terminal. A NULL value pointer\n clears the title (equivalent to setting an empty string).\n\n Input type: GhosttyString*"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_TITLE: GhosttyTerminalOption = 9;
#[doc = " Set the terminal working directory manually.\n\n The string data is copied into the terminal. A NULL value pointer\n clears the pwd (equivalent to setting an empty string).\n\n Input type: GhosttyString*"]
pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_PWD: GhosttyTerminalOption = 10;
#[doc = " Terminal option identifiers.\n\n These values are used with ghostty_terminal_set() to configure\n terminal callbacks and associated state.\n\n @ingroup terminal"]
pub type GhosttyTerminalOption = ::std::os::raw::c_uint;
#[doc = " Invalid data type. Never results in any data extraction."]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_INVALID: GhosttyTerminalData = 0;
#[doc = " Terminal width in cells.\n\n Output type: uint16_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_COLS: GhosttyTerminalData = 1;
#[doc = " Terminal height in cells.\n\n Output type: uint16_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_ROWS: GhosttyTerminalData = 2;
#[doc = " Cursor column position (0-indexed).\n\n Output type: uint16_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_X: GhosttyTerminalData = 3;
#[doc = " Cursor row position within the active area (0-indexed).\n\n Output type: uint16_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_Y: GhosttyTerminalData = 4;
#[doc = " Whether the cursor has a pending wrap (next print will soft-wrap).\n\n Output type: bool *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_PENDING_WRAP: GhosttyTerminalData = 5;
#[doc = " The currently active screen.\n\n Output type: GhosttyTerminalScreen *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_ACTIVE_SCREEN: GhosttyTerminalData = 6;
#[doc = " Whether the cursor is visible (DEC mode 25).\n\n Output type: bool *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_VISIBLE: GhosttyTerminalData = 7;
#[doc = " Current Kitty keyboard protocol flags.\n\n Output type: GhosttyKittyKeyFlags * (uint8_t *)"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_KITTY_KEYBOARD_FLAGS: GhosttyTerminalData = 8;
#[doc = " Scrollbar state for the terminal viewport.\n\n This may be expensive to calculate depending on where the viewport\n is (arbitrary pins are expensive). The caller should take care to only\n call this as needed and not too frequently.\n\n Output type: GhosttyTerminalScrollbar *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_SCROLLBAR: GhosttyTerminalData = 9;
#[doc = " The current SGR style of the cursor.\n\n This is the style that will be applied to newly printed characters.\n\n Output type: GhosttyStyle *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_CURSOR_STYLE: GhosttyTerminalData = 10;
#[doc = " Whether any mouse tracking mode is active.\n\n Returns true if any of the mouse tracking modes (X10, normal, button,\n or any-event) are enabled.\n\n Output type: bool *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_MOUSE_TRACKING: GhosttyTerminalData = 11;
#[doc = " The terminal title as set by escape sequences (e.g. OSC 0/2).\n\n Returns a borrowed string. The pointer is valid until the next call\n to ghostty_terminal_vt_write() or ghostty_terminal_reset(). An empty\n string (len=0) is returned when no title has been set.\n\n Output type: GhosttyString *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_TITLE: GhosttyTerminalData = 12;
#[doc = " The terminal's current working directory as set by escape sequences\n (e.g. OSC 7).\n\n Returns a borrowed string. The pointer is valid until the next call\n to ghostty_terminal_vt_write() or ghostty_terminal_reset(). An empty\n string (len=0) is returned when no pwd has been set.\n\n Output type: GhosttyString *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_PWD: GhosttyTerminalData = 13;
#[doc = " The total number of rows in the active screen including scrollback.\n\n Output type: size_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_TOTAL_ROWS: GhosttyTerminalData = 14;
#[doc = " The number of scrollback rows (total rows minus viewport rows).\n\n Output type: size_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_SCROLLBACK_ROWS: GhosttyTerminalData = 15;
#[doc = " The total width of the terminal in pixels.\n\n This is cols * cell_width_px as set by ghostty_terminal_resize().\n\n Output type: uint32_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_WIDTH_PX: GhosttyTerminalData = 16;
#[doc = " The total height of the terminal in pixels.\n\n This is rows * cell_height_px as set by ghostty_terminal_resize().\n\n Output type: uint32_t *"]
pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_HEIGHT_PX: GhosttyTerminalData = 17;
#[doc = " Terminal data types.\n\n These values specify what type of data to extract from a terminal\n using `ghostty_terminal_get`.\n\n @ingroup terminal"]
pub type GhosttyTerminalData = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Create a new terminal instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param terminal Pointer to store the created terminal handle\n @param options Terminal initialization options\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup terminal"]
    pub fn ghostty_terminal_new(
        allocator: *const GhosttyAllocator,
        terminal: *mut GhosttyTerminal_ptr,
        options: GhosttyTerminalOptions,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a terminal instance.\n\n Releases all resources associated with the terminal. After this call,\n the terminal handle becomes invalid and must not be used.\n\n @param terminal The terminal handle to free (may be NULL)\n\n @ingroup terminal"]
    pub fn ghostty_terminal_free(terminal: GhosttyTerminal_ptr);
}
unsafe extern "C" {
    #[doc = " Perform a full reset of the terminal (RIS).\n\n Resets all terminal state back to its initial configuration, including\n modes, scrollback, scrolling region, and screen contents. The terminal\n dimensions are preserved.\n\n @param terminal The terminal handle (may be NULL, in which case this is a no-op)\n\n @ingroup terminal"]
    pub fn ghostty_terminal_reset(terminal: GhosttyTerminal_ptr);
}
unsafe extern "C" {
    #[doc = " Resize the terminal to the given dimensions.\n\n Changes the number of columns and rows in the terminal. The primary\n screen will reflow content if wraparound mode is enabled; the alternate\n screen does not reflow. If the dimensions are unchanged, this is a no-op.\n\n This also updates the terminal's pixel dimensions (used for image\n protocols and size reports), disables synchronized output mode (allowed\n by the spec so that resize results are shown immediately), and sends an\n in-band size report if mode 2048 is enabled.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param cols New width in cells (must be greater than zero)\n @param rows New height in cells (must be greater than zero)\n @param cell_width_px Width of a single cell in pixels\n @param cell_height_px Height of a single cell in pixels\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup terminal"]
    pub fn ghostty_terminal_resize(
        terminal: GhosttyTerminal_ptr,
        cols: u16,
        rows: u16,
        cell_width_px: u32,
        cell_height_px: u32,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Set an option on the terminal.\n\n Configures terminal callbacks and associated state such as the\n write_pty callback and userdata pointer. The value is passed\n directly for pointer types (callbacks, userdata) or as a pointer\n to the value for non-pointer types (e.g. GhosttyString*).\n NULL clears the option to its default.\n\n Callbacks are invoked synchronously during ghostty_terminal_vt_write().\n Callbacks must not call ghostty_terminal_vt_write() on the same\n terminal (no reentrancy).\n\n @param terminal The terminal handle (may be NULL, in which case this is a no-op)\n @param option The option to set\n @param value Pointer to the value to set (type depends on the option),\n              or NULL to clear the option\n\n @ingroup terminal"]
    pub fn ghostty_terminal_set(
        terminal: GhosttyTerminal_ptr,
        option: GhosttyTerminalOption,
        value: *const ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Write VT-encoded data to the terminal for processing.\n\n Feeds raw bytes through the terminal's VT stream parser, updating\n terminal state accordingly. By default, sequences that require output\n (queries, device status reports) are silently ignored. Use\n ghostty_terminal_set() with GHOSTTY_TERMINAL_OPT_WRITE_PTY to install\n a callback that receives response data.\n\n This never fails. Any erroneous input or errors in processing the\n input are logged internally but do not cause this function to fail\n because this input is assumed to be untrusted and from an external\n source; so the primary goal is to keep the terminal state consistent and\n not allow malformed input to corrupt or crash.\n\n @param terminal The terminal handle\n @param data Pointer to the data to write\n @param len Length of the data in bytes\n\n @ingroup terminal"]
    pub fn ghostty_terminal_vt_write(terminal: GhosttyTerminal_ptr, data: *const u8, len: usize);
}
unsafe extern "C" {
    #[doc = " Scroll the terminal viewport.\n\n Scrolls the terminal's viewport according to the given behavior.\n When using GHOSTTY_SCROLL_VIEWPORT_DELTA, set the delta field in\n the value union to specify the number of rows to scroll (negative\n for up, positive for down). For other behaviors, the value is ignored.\n\n @param terminal The terminal handle (may be NULL, in which case this is a no-op)\n @param behavior The scroll behavior as a tagged union\n\n @ingroup terminal"]
    pub fn ghostty_terminal_scroll_viewport(
        terminal: GhosttyTerminal_ptr,
        behavior: GhosttyTerminalScrollViewport,
    );
}
unsafe extern "C" {
    #[doc = " Get the current value of a terminal mode.\n\n Returns the value of the mode identified by the given mode.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param mode The mode identifying the mode to query\n @param[out] out_value On success, set to true if the mode is set, false\n             if it is reset\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the mode does not correspond to a known mode\n\n @ingroup terminal"]
    pub fn ghostty_terminal_mode_get(
        terminal: GhosttyTerminal_ptr,
        mode: GhosttyMode,
        out_value: *mut bool,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Set the value of a terminal mode.\n\n Sets the mode identified by the given mode to the specified value.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param mode The mode identifying the mode to set\n @param value true to set the mode, false to reset it\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the mode does not correspond to a known mode\n\n @ingroup terminal"]
    pub fn ghostty_terminal_mode_set(
        terminal: GhosttyTerminal_ptr,
        mode: GhosttyMode,
        value: bool,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get data from a terminal instance.\n\n Extracts typed data from the given terminal based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid data types and output types are documented\n in the `GhosttyTerminalData` enum.\n\n @param terminal The terminal handle (may be NULL)\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the data type is invalid\n\n @ingroup terminal"]
    pub fn ghostty_terminal_get(
        terminal: GhosttyTerminal_ptr,
        data: GhosttyTerminalData,
        out: *mut ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Resolve a point in the terminal grid to a grid reference.\n\n Resolves the given point (which can be in active, viewport, screen,\n or history coordinates) to a grid reference for that location. Use\n ghostty_grid_ref_cell() and ghostty_grid_ref_row() to extract the cell\n and row.\n\n Lookups using the `active` and `viewport` tags are fast. The `screen`\n and `history` tags may require traversing the full scrollback page list\n to resolve the y coordinate, so they can be expensive for large\n scrollback buffers.\n\n This function isn't meant to be used as the core of render loop. It\n isn't built to sustain the framerates needed for rendering large screens.\n Use the render state API for that. This API is instead meant for less\n strictly performance-sensitive use cases.\n\n @param terminal The terminal handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param point The point specifying which cell to look up\n @param[out] out_ref On success, set to the grid reference at the given point (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the terminal\n         is NULL or the point is out of bounds\n\n @ingroup terminal"]
    pub fn ghostty_terminal_grid_ref(
        terminal: GhosttyTerminal_ptr,
        point: GhosttyPoint,
        out_ref: *mut GhosttyGridRef,
    ) -> GhosttyResult;
}
#[doc = " Plain text (no escape sequences)."]
pub const GhosttyFormatterFormat_GHOSTTY_FORMATTER_FORMAT_PLAIN: GhosttyFormatterFormat = 0;
#[doc = " VT sequences preserving colors, styles, URLs, etc."]
pub const GhosttyFormatterFormat_GHOSTTY_FORMATTER_FORMAT_VT: GhosttyFormatterFormat = 1;
#[doc = " HTML with inline styles."]
pub const GhosttyFormatterFormat_GHOSTTY_FORMATTER_FORMAT_HTML: GhosttyFormatterFormat = 2;
#[doc = " Output format.\n\n @ingroup formatter"]
pub type GhosttyFormatterFormat = ::std::os::raw::c_uint;
#[doc = " Extra screen state to include in styled output.\n\n @ingroup formatter"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyFormatterScreenExtra {
    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyFormatterScreenExtra)."]
    pub size: usize,
    #[doc = " Emit cursor position using CUP (CSI H)."]
    pub cursor: bool,
    #[doc = " Emit current SGR style state based on the cursor's active style_id."]
    pub style: bool,
    #[doc = " Emit current hyperlink state using OSC 8 sequences."]
    pub hyperlink: bool,
    #[doc = " Emit character protection mode using DECSCA."]
    pub protection: bool,
    #[doc = " Emit Kitty keyboard protocol state using CSI > u and CSI = sequences."]
    pub kitty_keyboard: bool,
    #[doc = " Emit character set designations and invocations."]
    pub charsets: bool,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyFormatterScreenExtra"]
        [::std::mem::size_of::<GhosttyFormatterScreenExtra>() - 16usize];
    ["Alignment of GhosttyFormatterScreenExtra"]
        [::std::mem::align_of::<GhosttyFormatterScreenExtra>() - 8usize];
    ["Offset of field: GhosttyFormatterScreenExtra::size"]
        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, size) - 0usize];
    ["Offset of field: GhosttyFormatterScreenExtra::cursor"]
        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, cursor) - 8usize];
    ["Offset of field: GhosttyFormatterScreenExtra::style"]
        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, style) - 9usize];
    ["Offset of field: GhosttyFormatterScreenExtra::hyperlink"]
        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, hyperlink) - 10usize];
    ["Offset of field: GhosttyFormatterScreenExtra::protection"]
        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, protection) - 11usize];
    ["Offset of field: GhosttyFormatterScreenExtra::kitty_keyboard"]
        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, kitty_keyboard) - 12usize];
    ["Offset of field: GhosttyFormatterScreenExtra::charsets"]
        [::std::mem::offset_of!(GhosttyFormatterScreenExtra, charsets) - 13usize];
};
#[doc = " Extra terminal state to include in styled output.\n\n @ingroup formatter"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyFormatterTerminalExtra {
    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyFormatterTerminalExtra)."]
    pub size: usize,
    #[doc = " Emit the palette using OSC 4 sequences."]
    pub palette: bool,
    #[doc = " Emit terminal modes that differ from their defaults using CSI h/l."]
    pub modes: bool,
    #[doc = " Emit scrolling region state using DECSTBM and DECSLRM sequences."]
    pub scrolling_region: bool,
    #[doc = " Emit tabstop positions by clearing all tabs and setting each one."]
    pub tabstops: bool,
    #[doc = " Emit the present working directory using OSC 7."]
    pub pwd: bool,
    #[doc = " Emit keyboard modes such as ModifyOtherKeys."]
    pub keyboard: bool,
    #[doc = " Screen-level extras."]
    pub screen: GhosttyFormatterScreenExtra,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyFormatterTerminalExtra"]
        [::std::mem::size_of::<GhosttyFormatterTerminalExtra>() - 32usize];
    ["Alignment of GhosttyFormatterTerminalExtra"]
        [::std::mem::align_of::<GhosttyFormatterTerminalExtra>() - 8usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::size"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, size) - 0usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::palette"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, palette) - 8usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::modes"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, modes) - 9usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::scrolling_region"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, scrolling_region) - 10usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::tabstops"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, tabstops) - 11usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::pwd"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, pwd) - 12usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::keyboard"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, keyboard) - 13usize];
    ["Offset of field: GhosttyFormatterTerminalExtra::screen"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalExtra, screen) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyFormatter {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a formatter instance.\n\n @ingroup formatter"]
pub type GhosttyFormatter_ptr = *mut GhosttyFormatter;
#[doc = " Options for creating a terminal formatter.\n\n @ingroup formatter"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyFormatterTerminalOptions {
    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyFormatterTerminalOptions)."]
    pub size: usize,
    #[doc = " Output format to emit."]
    pub emit: GhosttyFormatterFormat,
    #[doc = " Whether to unwrap soft-wrapped lines."]
    pub unwrap: bool,
    #[doc = " Whether to trim trailing whitespace on non-blank lines."]
    pub trim: bool,
    #[doc = " Extra terminal state to include in styled output."]
    pub extra: GhosttyFormatterTerminalExtra,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyFormatterTerminalOptions"]
        [::std::mem::size_of::<GhosttyFormatterTerminalOptions>() - 48usize];
    ["Alignment of GhosttyFormatterTerminalOptions"]
        [::std::mem::align_of::<GhosttyFormatterTerminalOptions>() - 8usize];
    ["Offset of field: GhosttyFormatterTerminalOptions::size"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, size) - 0usize];
    ["Offset of field: GhosttyFormatterTerminalOptions::emit"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, emit) - 8usize];
    ["Offset of field: GhosttyFormatterTerminalOptions::unwrap"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, unwrap) - 12usize];
    ["Offset of field: GhosttyFormatterTerminalOptions::trim"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, trim) - 13usize];
    ["Offset of field: GhosttyFormatterTerminalOptions::extra"]
        [::std::mem::offset_of!(GhosttyFormatterTerminalOptions, extra) - 16usize];
};
impl Default for GhosttyFormatterTerminalOptions {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
unsafe extern "C" {
    #[doc = " Create a formatter for a terminal's active screen.\n\n The terminal must outlive the formatter. The formatter stores a borrowed\n reference to the terminal and reads its current state on each format call.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param formatter Pointer to store the created formatter handle\n @param terminal The terminal to format (must not be NULL)\n @param options Formatting options\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup formatter"]
    pub fn ghostty_formatter_terminal_new(
        allocator: *const GhosttyAllocator,
        formatter: *mut GhosttyFormatter_ptr,
        terminal: GhosttyTerminal_ptr,
        options: GhosttyFormatterTerminalOptions,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Run the formatter and produce output into the caller-provided buffer.\n\n Each call formats the current terminal state. Pass NULL for buf to\n query the required buffer size without writing any output; in that case\n out_written receives the required size and the return value is\n GHOSTTY_OUT_OF_SPACE.\n\n If the buffer is too small, returns GHOSTTY_OUT_OF_SPACE and sets\n out_written to the required size. The caller can then retry with a\n larger buffer.\n\n @param formatter The formatter handle (must not be NULL)\n @param buf Pointer to the output buffer, or NULL to query size\n @param buf_len Length of the output buffer in bytes\n @param out_written Pointer to receive the number of bytes written,\n                    or the required size on failure\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup formatter"]
    pub fn ghostty_formatter_format_buf(
        formatter: GhosttyFormatter_ptr,
        buf: *mut u8,
        buf_len: usize,
        out_written: *mut usize,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Run the formatter and return an allocated buffer with the output.\n\n Each call formats the current terminal state. The buffer is allocated\n using the provided allocator (or the default allocator if NULL).\n The caller is responsible for freeing the returned buffer with\n ghostty_free(), passing the same allocator (or NULL for the default)\n that was used for the allocation.\n\n @param formatter The formatter handle (must not be NULL)\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param out_ptr Pointer to receive the allocated buffer\n @param out_len Pointer to receive the length of the output in bytes\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n         failure\n\n @ingroup formatter"]
    pub fn ghostty_formatter_format_alloc(
        formatter: GhosttyFormatter_ptr,
        allocator: *const GhosttyAllocator,
        out_ptr: *mut *mut u8,
        out_len: *mut usize,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a formatter instance.\n\n Releases all resources associated with the formatter. After this call,\n the formatter handle becomes invalid.\n\n @param formatter The formatter handle to free (may be NULL)\n\n @ingroup formatter"]
    pub fn ghostty_formatter_free(formatter: GhosttyFormatter_ptr);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyRenderState {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a render state instance.\n\n @ingroup render"]
pub type GhosttyRenderState_ptr = *mut GhosttyRenderState;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyRenderStateRowIterator {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a render-state row iterator.\n\n @ingroup render"]
pub type GhosttyRenderStateRowIterator_ptr = *mut GhosttyRenderStateRowIterator;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyRenderStateRowCells {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to render-state row cells.\n\n @ingroup render"]
pub type GhosttyRenderStateRowCells_ptr = *mut GhosttyRenderStateRowCells;
#[doc = " Not dirty at all; rendering can be skipped."]
pub const GhosttyRenderStateDirty_GHOSTTY_RENDER_STATE_DIRTY_FALSE: GhosttyRenderStateDirty = 0;
#[doc = " Some rows changed; renderer can redraw incrementally."]
pub const GhosttyRenderStateDirty_GHOSTTY_RENDER_STATE_DIRTY_PARTIAL: GhosttyRenderStateDirty = 1;
#[doc = " Global state changed; renderer should redraw everything."]
pub const GhosttyRenderStateDirty_GHOSTTY_RENDER_STATE_DIRTY_FULL: GhosttyRenderStateDirty = 2;
#[doc = " Dirty state of a render state after update.\n\n @ingroup render"]
pub type GhosttyRenderStateDirty = ::std::os::raw::c_uint;
#[doc = " Bar cursor (DECSCUSR 5, 6)."]
pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BAR:
    GhosttyRenderStateCursorVisualStyle = 0;
#[doc = " Block cursor (DECSCUSR 1, 2)."]
pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BLOCK:
    GhosttyRenderStateCursorVisualStyle = 1;
#[doc = " Underline cursor (DECSCUSR 3, 4)."]
pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_UNDERLINE:
    GhosttyRenderStateCursorVisualStyle = 2;
#[doc = " Hollow block cursor."]
pub const GhosttyRenderStateCursorVisualStyle_GHOSTTY_RENDER_STATE_CURSOR_VISUAL_STYLE_BLOCK_HOLLOW : GhosttyRenderStateCursorVisualStyle = 3 ;
#[doc = " Visual style of the cursor.\n\n @ingroup render"]
pub type GhosttyRenderStateCursorVisualStyle = ::std::os::raw::c_uint;
#[doc = " Invalid / sentinel value."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_INVALID: GhosttyRenderStateData = 0;
#[doc = " Viewport width in cells (uint16_t)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLS: GhosttyRenderStateData = 1;
#[doc = " Viewport height in cells (uint16_t)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_ROWS: GhosttyRenderStateData = 2;
#[doc = " Current dirty state (GhosttyRenderStateDirty)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_DIRTY: GhosttyRenderStateData = 3;
#[doc = " Populate a pre-allocated GhosttyRenderStateRowIterator with row data\n  from the render state (GhosttyRenderStateRowIterator). Row data is\n  only valid as long as the underlying render state is not updated.\n  It is unsafe to use row data after updating the render state."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_ROW_ITERATOR: GhosttyRenderStateData = 4;
#[doc = " Default/current background color (GhosttyColorRgb)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_BACKGROUND:
    GhosttyRenderStateData = 5;
#[doc = " Default/current foreground color (GhosttyColorRgb)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_FOREGROUND:
    GhosttyRenderStateData = 6;
#[doc = " Cursor color when explicitly set by terminal state (GhosttyColorRgb).\n  Returns GHOSTTY_INVALID_VALUE if no explicit cursor color is set;\n  use COLOR_CURSOR_HAS_VALUE to check first."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR: GhosttyRenderStateData = 7;
#[doc = " Whether an explicit cursor color is set (bool)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_CURSOR_HAS_VALUE:
    GhosttyRenderStateData = 8;
#[doc = " The active 256-color palette (GhosttyColorRgb[256])."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_COLOR_PALETTE: GhosttyRenderStateData =
    9;
#[doc = " The visual style of the cursor (GhosttyRenderStateCursorVisualStyle)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VISUAL_STYLE:
    GhosttyRenderStateData = 10;
#[doc = " Whether the cursor is visible based on terminal modes (bool)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VISIBLE: GhosttyRenderStateData =
    11;
#[doc = " Whether the cursor should blink based on terminal modes (bool)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_BLINKING: GhosttyRenderStateData =
    12;
#[doc = " Whether the cursor is at a password input field (bool)."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_PASSWORD_INPUT:
    GhosttyRenderStateData = 13;
#[doc = " Whether the cursor is visible within the viewport (bool).\n  If false, the cursor viewport position values are undefined."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_HAS_VALUE:
    GhosttyRenderStateData = 14;
#[doc = " Cursor viewport x position in cells (uint16_t).\n  Only valid when CURSOR_VIEWPORT_HAS_VALUE is true."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_X:
    GhosttyRenderStateData = 15;
#[doc = " Cursor viewport y position in cells (uint16_t).\n  Only valid when CURSOR_VIEWPORT_HAS_VALUE is true."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_Y:
    GhosttyRenderStateData = 16;
#[doc = " Whether the cursor is on the tail of a wide character (bool).\n  Only valid when CURSOR_VIEWPORT_HAS_VALUE is true."]
pub const GhosttyRenderStateData_GHOSTTY_RENDER_STATE_DATA_CURSOR_VIEWPORT_WIDE_TAIL:
    GhosttyRenderStateData = 17;
#[doc = " Queryable data kinds for ghostty_render_state_get().\n\n @ingroup render"]
pub type GhosttyRenderStateData = ::std::os::raw::c_uint;
#[doc = " Set dirty state (GhosttyRenderStateDirty)."]
pub const GhosttyRenderStateOption_GHOSTTY_RENDER_STATE_OPTION_DIRTY: GhosttyRenderStateOption = 0;
#[doc = " Settable options for ghostty_render_state_set().\n\n @ingroup render"]
pub type GhosttyRenderStateOption = ::std::os::raw::c_uint;
#[doc = " Invalid / sentinel value."]
pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_INVALID:
    GhosttyRenderStateRowData = 0;
#[doc = " Whether the current row is dirty (bool)."]
pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_DIRTY: GhosttyRenderStateRowData =
    1;
#[doc = " The raw row value (GhosttyRow)."]
pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_RAW: GhosttyRenderStateRowData =
    2;
#[doc = " Populate a pre-allocated GhosttyRenderStateRowCells with cell data for\n  the current row (GhosttyRenderStateRowCells). Cell data is only\n  valid as long as the underlying render state is not updated.\n  It is unsafe to use cell data after updating the render state."]
pub const GhosttyRenderStateRowData_GHOSTTY_RENDER_STATE_ROW_DATA_CELLS: GhosttyRenderStateRowData =
    3;
#[doc = " Queryable data kinds for ghostty_render_state_row_get().\n\n @ingroup render"]
pub type GhosttyRenderStateRowData = ::std::os::raw::c_uint;
#[doc = " Set dirty state for the current row (bool)."]
pub const GhosttyRenderStateRowOption_GHOSTTY_RENDER_STATE_ROW_OPTION_DIRTY:
    GhosttyRenderStateRowOption = 0;
#[doc = " Settable options for ghostty_render_state_row_set().\n\n @ingroup render"]
pub type GhosttyRenderStateRowOption = ::std::os::raw::c_uint;
#[doc = " Render-state color information.\n\n This struct uses the sized-struct ABI pattern. Initialize with\n GHOSTTY_INIT_SIZED(GhosttyRenderStateColors) before calling\n ghostty_render_state_colors_get().\n\n Example:\n @code\n GhosttyRenderStateColors colors = GHOSTTY_INIT_SIZED(GhosttyRenderStateColors);\n GhosttyResult result = ghostty_render_state_colors_get(state, &colors);\n @endcode\n\n @ingroup render"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyRenderStateColors {
    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyRenderStateColors)."]
    pub size: usize,
    #[doc = " The default/current background color for the render state."]
    pub background: GhosttyColorRgb,
    #[doc = " The default/current foreground color for the render state."]
    pub foreground: GhosttyColorRgb,
    #[doc = " The cursor color when explicitly set by terminal state."]
    pub cursor: GhosttyColorRgb,
    #[doc = " True when cursor contains a valid explicit cursor color value.\n If this is false, the cursor color should be ignored; it will\n contain undefined data."]
    pub cursor_has_value: bool,
    #[doc = " The active 256-color palette for this render state."]
    pub palette: [GhosttyColorRgb; 256usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyRenderStateColors"]
        [::std::mem::size_of::<GhosttyRenderStateColors>() - 792usize];
    ["Alignment of GhosttyRenderStateColors"]
        [::std::mem::align_of::<GhosttyRenderStateColors>() - 8usize];
    ["Offset of field: GhosttyRenderStateColors::size"]
        [::std::mem::offset_of!(GhosttyRenderStateColors, size) - 0usize];
    ["Offset of field: GhosttyRenderStateColors::background"]
        [::std::mem::offset_of!(GhosttyRenderStateColors, background) - 8usize];
    ["Offset of field: GhosttyRenderStateColors::foreground"]
        [::std::mem::offset_of!(GhosttyRenderStateColors, foreground) - 11usize];
    ["Offset of field: GhosttyRenderStateColors::cursor"]
        [::std::mem::offset_of!(GhosttyRenderStateColors, cursor) - 14usize];
    ["Offset of field: GhosttyRenderStateColors::cursor_has_value"]
        [::std::mem::offset_of!(GhosttyRenderStateColors, cursor_has_value) - 17usize];
    ["Offset of field: GhosttyRenderStateColors::palette"]
        [::std::mem::offset_of!(GhosttyRenderStateColors, palette) - 18usize];
};
impl Default for GhosttyRenderStateColors {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
unsafe extern "C" {
    #[doc = " Create a new render state instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param state Pointer to store the created render state handle\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n failure\n\n @ingroup render"]
    pub fn ghostty_render_state_new(
        allocator: *const GhosttyAllocator,
        state: *mut GhosttyRenderState_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a render state instance.\n\n Releases all resources associated with the render state. After this call,\n the render state handle becomes invalid.\n\n @param state The render state handle to free (may be NULL)\n\n @ingroup render"]
    pub fn ghostty_render_state_free(state: GhosttyRenderState_ptr);
}
unsafe extern "C" {
    #[doc = " Update a render state instance from a terminal.\n\n This consumes terminal/screen dirty state in the same way as the internal\n render state update path.\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param terminal The terminal handle to read from (NULL returns GHOSTTY_INVALID_VALUE)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` or\n `terminal` is NULL, GHOSTTY_OUT_OF_MEMORY if updating the state requires\n allocation and that allocation fails\n\n @ingroup render"]
    pub fn ghostty_render_state_update(
        state: GhosttyRenderState_ptr,
        terminal: GhosttyTerminal_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get a value from a render state.\n\n The `out` pointer must point to a value of the type corresponding to the\n requested data kind (see GhosttyRenderStateData).\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param data The data kind to query\n @param[out] out Pointer to receive the queried value\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` is\n         NULL or `data` is not a recognized enum value\n\n @ingroup render"]
    pub fn ghostty_render_state_get(
        state: GhosttyRenderState_ptr,
        data: GhosttyRenderStateData,
        out: *mut ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Set an option on a render state.\n\n The `value` pointer must point to a value of the type corresponding to the\n requested option kind (see GhosttyRenderStateOption).\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param option The option to set\n @param[in] value Pointer to the value to set (NULL returns\n            GHOSTTY_INVALID_VALUE)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` or\n         `value` is NULL\n\n @ingroup render"]
    pub fn ghostty_render_state_set(
        state: GhosttyRenderState_ptr,
        option: GhosttyRenderStateOption,
        value: *const ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get the current color information from a render state.\n\n This writes as many fields as fit in the caller-provided sized struct.\n `out_colors->size` must be set by the caller (typically via\n GHOSTTY_INIT_SIZED(GhosttyRenderStateColors)).\n\n @param state The render state handle (NULL returns GHOSTTY_INVALID_VALUE)\n @param[out] out_colors Sized output struct to receive render-state colors\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `state` or\n         `out_colors` is NULL, or if `out_colors->size` is smaller than\n         `sizeof(size_t)`\n\n @ingroup render"]
    pub fn ghostty_render_state_colors_get(
        state: GhosttyRenderState_ptr,
        out_colors: *mut GhosttyRenderStateColors,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Create a new row iterator instance.\n\n All fields except the allocator are left undefined until populated\n via ghostty_render_state_get() with\n GHOSTTY_RENDER_STATE_DATA_ROW_ITERATOR.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param[out] out_iterator On success, receives the created iterator handle\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n         failure\n\n @ingroup render"]
    pub fn ghostty_render_state_row_iterator_new(
        allocator: *const GhosttyAllocator,
        out_iterator: *mut GhosttyRenderStateRowIterator_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a render-state row iterator.\n\n @param iterator The iterator handle to free (may be NULL)\n\n @ingroup render"]
    pub fn ghostty_render_state_row_iterator_free(iterator: GhosttyRenderStateRowIterator_ptr);
}
unsafe extern "C" {
    #[doc = " Move a render-state row iterator to the next row.\n\n Returns true if the iterator moved successfully and row data is\n available to read at the new position.\n\n @param iterator The iterator handle to advance (may be NULL)\n @return true if advanced to the next row, false if `iterator` is\n         NULL or if the iterator has reached the end\n\n @ingroup render"]
    pub fn ghostty_render_state_row_iterator_next(
        iterator: GhosttyRenderStateRowIterator_ptr,
    ) -> bool;
}
unsafe extern "C" {
    #[doc = " Get a value from the current row in a render-state row iterator.\n\n The `out` pointer must point to a value of the type corresponding to the\n requested data kind (see GhosttyRenderStateRowData).\n Call ghostty_render_state_row_iterator_next() at least once before\n calling this function.\n\n @param iterator The iterator handle to query (NULL returns GHOSTTY_INVALID_VALUE)\n @param data The data kind to query\n @param[out] out Pointer to receive the queried value\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if\n         `iterator` is NULL or the iterator is not positioned on a row\n\n @ingroup render"]
    pub fn ghostty_render_state_row_get(
        iterator: GhosttyRenderStateRowIterator_ptr,
        data: GhosttyRenderStateRowData,
        out: *mut ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Set an option on the current row in a render-state row iterator.\n\n The `value` pointer must point to a value of the type corresponding to the\n requested option kind (see GhosttyRenderStateRowOption).\n Call ghostty_render_state_row_iterator_next() at least once before\n calling this function.\n\n @param iterator The iterator handle to update (NULL returns GHOSTTY_INVALID_VALUE)\n @param option The option to set\n @param[in] value Pointer to the value to set (NULL returns\n            GHOSTTY_INVALID_VALUE)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if\n         `iterator` is NULL or the iterator is not positioned on a row\n\n @ingroup render"]
    pub fn ghostty_render_state_row_set(
        iterator: GhosttyRenderStateRowIterator_ptr,
        option: GhosttyRenderStateRowOption,
        value: *const ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Create a new row cells instance.\n\n All fields except the allocator are left undefined until populated\n via ghostty_render_state_row_get() with\n GHOSTTY_RENDER_STATE_ROW_DATA_CELLS.\n\n You can reuse this value repeatedly with ghostty_render_state_row_get() to\n avoid allocating a new cells container for every row.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param[out] out_cells On success, receives the created row cells handle\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY on allocation\n         failure\n\n @ingroup render"]
    pub fn ghostty_render_state_row_cells_new(
        allocator: *const GhosttyAllocator,
        out_cells: *mut GhosttyRenderStateRowCells_ptr,
    ) -> GhosttyResult;
}
#[doc = " Invalid / sentinel value."]
pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_INVALID:
    GhosttyRenderStateRowCellsData = 0;
#[doc = " The raw cell value (GhosttyCell)."]
pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_RAW:
    GhosttyRenderStateRowCellsData = 1;
#[doc = " The style for the current cell (GhosttyStyle)."]
pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_STYLE:
    GhosttyRenderStateRowCellsData = 2;
#[doc = " The total number of grapheme codepoints including the base codepoint\n  (uint32_t). Returns 0 if the cell has no text."]
pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_GRAPHEMES_LEN:
    GhosttyRenderStateRowCellsData = 3;
#[doc = " Write grapheme codepoints into a caller-provided buffer (uint32_t*).\n  The buffer must be at least graphemes_len elements. The base codepoint\n  is written first, followed by any extra codepoints."]
pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_GRAPHEMES_BUF:
    GhosttyRenderStateRowCellsData = 4;
#[doc = " The resolved background color of the cell (GhosttyColorRgb).\n  Flattens the three possible sources: content-tag bg_color_rgb,\n  content-tag bg_color_palette (looked up in the palette), or the\n  style's bg_color. Returns GHOSTTY_INVALID_VALUE if the cell has\n  no background color, in which case the caller should use whatever\n  default background color it wants (e.g. the terminal background)."]
pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_BG_COLOR:
    GhosttyRenderStateRowCellsData = 5;
#[doc = " The resolved foreground color of the cell (GhosttyColorRgb).\n  Resolves palette indices through the palette. Bold color handling\n  is not applied; the caller should handle bold styling separately.\n  Returns GHOSTTY_INVALID_VALUE if the cell has no explicit foreground\n  color, in which case the caller should use whatever default foreground\n  color it wants (e.g. the terminal foreground)."]
pub const GhosttyRenderStateRowCellsData_GHOSTTY_RENDER_STATE_ROW_CELLS_DATA_FG_COLOR:
    GhosttyRenderStateRowCellsData = 6;
#[doc = " Queryable data kinds for ghostty_render_state_row_cells_get().\n\n @ingroup render"]
pub type GhosttyRenderStateRowCellsData = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Move a render-state row cells iterator to the next cell.\n\n Returns true if the iterator moved successfully and cell data is\n available to read at the new position.\n\n @param cells The row cells handle to advance (may be NULL)\n @return true if advanced to the next cell, false if `cells` is\n         NULL or if the iterator has reached the end\n\n @ingroup render"]
    pub fn ghostty_render_state_row_cells_next(cells: GhosttyRenderStateRowCells_ptr) -> bool;
}
unsafe extern "C" {
    #[doc = " Move a render-state row cells iterator to a specific column.\n\n Positions the iterator at the given x (column) index so that\n subsequent reads return data for that cell.\n\n @param cells The row cells handle to reposition (NULL returns\n        GHOSTTY_INVALID_VALUE)\n @param x The zero-based column index to select\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if `cells`\n         is NULL or `x` is out of range\n\n @ingroup render"]
    pub fn ghostty_render_state_row_cells_select(
        cells: GhosttyRenderStateRowCells_ptr,
        x: u16,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get a value from the current cell in a render-state row cells iterator.\n\n The `out` pointer must point to a value of the type corresponding to the\n requested data kind (see GhosttyRenderStateRowCellsData).\n Call ghostty_render_state_row_cells_next() or\n ghostty_render_state_row_cells_select() at least once before\n calling this function.\n\n @param cells The row cells handle to query (NULL returns GHOSTTY_INVALID_VALUE)\n @param data The data kind to query\n @param[out] out Pointer to receive the queried value\n @return GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if\n         `cells` is NULL or the iterator is not positioned on a cell\n\n @ingroup render"]
    pub fn ghostty_render_state_row_cells_get(
        cells: GhosttyRenderStateRowCells_ptr,
        data: GhosttyRenderStateRowCellsData,
        out: *mut ::std::os::raw::c_void,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a row cells instance.\n\n @param cells The row cells handle to free (may be NULL)\n\n @ingroup render"]
    pub fn ghostty_render_state_row_cells_free(cells: GhosttyRenderStateRowCells_ptr);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyOscParser {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to an OSC parser instance.\n\n This handle represents an OSC (Operating System Command) parser that can\n be used to parse the contents of OSC sequences.\n\n @ingroup osc"]
pub type GhosttyOscParser_ptr = *mut GhosttyOscParser;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyOscCommand {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a single OSC command.\n\n This handle represents a parsed OSC (Operating System Command) command.\n The command can be queried for its type and associated data.\n\n @ingroup osc"]
pub type GhosttyOscCommand_ptr = *mut GhosttyOscCommand;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_INVALID: GhosttyOscCommandType = 0;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE: GhosttyOscCommandType = 1;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_ICON: GhosttyOscCommandType = 2;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_SEMANTIC_PROMPT: GhosttyOscCommandType = 3;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CLIPBOARD_CONTENTS: GhosttyOscCommandType = 4;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_REPORT_PWD: GhosttyOscCommandType = 5;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_MOUSE_SHAPE: GhosttyOscCommandType = 6;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_COLOR_OPERATION: GhosttyOscCommandType = 7;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_KITTY_COLOR_PROTOCOL: GhosttyOscCommandType = 8;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_SHOW_DESKTOP_NOTIFICATION:
    GhosttyOscCommandType = 9;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_HYPERLINK_START: GhosttyOscCommandType = 10;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_HYPERLINK_END: GhosttyOscCommandType = 11;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_SLEEP: GhosttyOscCommandType = 12;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_SHOW_MESSAGE_BOX: GhosttyOscCommandType =
    13;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_CHANGE_TAB_TITLE: GhosttyOscCommandType =
    14;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_PROGRESS_REPORT: GhosttyOscCommandType =
    15;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_WAIT_INPUT: GhosttyOscCommandType = 16;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_GUIMACRO: GhosttyOscCommandType = 17;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_RUN_PROCESS: GhosttyOscCommandType = 18;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_OUTPUT_ENVIRONMENT_VARIABLE:
    GhosttyOscCommandType = 19;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_XTERM_EMULATION: GhosttyOscCommandType =
    20;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_CONEMU_COMMENT: GhosttyOscCommandType = 21;
pub const GhosttyOscCommandType_GHOSTTY_OSC_COMMAND_KITTY_TEXT_SIZING: GhosttyOscCommandType = 22;
#[doc = " OSC command types.\n\n @ingroup osc"]
pub type GhosttyOscCommandType = ::std::os::raw::c_uint;
#[doc = " Invalid data type. Never results in any data extraction."]
pub const GhosttyOscCommandData_GHOSTTY_OSC_DATA_INVALID: GhosttyOscCommandData = 0;
#[doc = " Window title string data.\n\n Valid for: GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE\n\n Output type: const char ** (pointer to null-terminated string)\n\n Lifetime: Valid until the next call to any ghostty_osc_* function with\n the same parser instance. Memory is owned by the parser."]
pub const GhosttyOscCommandData_GHOSTTY_OSC_DATA_CHANGE_WINDOW_TITLE_STR: GhosttyOscCommandData = 1;
#[doc = " OSC command data types.\n\n These values specify what type of data to extract from an OSC command\n using `ghostty_osc_command_data`.\n\n @ingroup osc"]
pub type GhosttyOscCommandData = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Create a new OSC parser instance.\n\n Creates a new OSC (Operating System Command) parser using the provided\n allocator. The parser must be freed using ghostty_vt_osc_free() when\n no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator\n @param parser Pointer to store the created parser handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup osc"]
    pub fn ghostty_osc_new(
        allocator: *const GhosttyAllocator,
        parser: *mut GhosttyOscParser_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free an OSC parser instance.\n\n Releases all resources associated with the OSC parser. After this call,\n the parser handle becomes invalid and must not be used.\n\n @param parser The parser handle to free (may be NULL)\n\n @ingroup osc"]
    pub fn ghostty_osc_free(parser: GhosttyOscParser_ptr);
}
unsafe extern "C" {
    #[doc = " Reset an OSC parser instance to its initial state.\n\n Resets the parser state, clearing any partially parsed OSC sequences\n and returning the parser to its initial state. This is useful for\n reusing a parser instance or recovering from parse errors.\n\n @param parser The parser handle to reset, must not be null.\n\n @ingroup osc"]
    pub fn ghostty_osc_reset(parser: GhosttyOscParser_ptr);
}
unsafe extern "C" {
    #[doc = " Parse the next byte in an OSC sequence.\n\n Processes a single byte as part of an OSC sequence. The parser maintains\n internal state to track the progress through the sequence. Call this\n function for each byte in the sequence data.\n\n When finished pumping the parser with bytes, call ghostty_osc_end\n to get the final result.\n\n @param parser The parser handle, must not be null.\n @param byte The next byte to parse\n\n @ingroup osc"]
    pub fn ghostty_osc_next(parser: GhosttyOscParser_ptr, byte: u8);
}
unsafe extern "C" {
    #[doc = " Finalize OSC parsing and retrieve the parsed command.\n\n Call this function after feeding all bytes of an OSC sequence to the parser\n using ghostty_osc_next() with the exception of the terminating character\n (ESC or ST). This function finalizes the parsing process and returns the\n parsed OSC command.\n\n The return value is never NULL. Invalid commands will return a command\n with type GHOSTTY_OSC_COMMAND_INVALID.\n\n The terminator parameter specifies the byte that terminated the OSC sequence\n (typically 0x07 for BEL or 0x5C for ST after ESC). This information is\n preserved in the parsed command so that responses can use the same terminator\n format for better compatibility with the calling program. For commands that\n do not require a response, this parameter is ignored and the resulting\n command will not retain the terminator information.\n\n The returned command handle is valid until the next call to any\n `ghostty_osc_*` function with the same parser instance with the exception\n of command introspection functions such as `ghostty_osc_command_type`.\n\n @param parser The parser handle, must not be null.\n @param terminator The terminating byte of the OSC sequence (0x07 for BEL, 0x5C for ST)\n @return Handle to the parsed OSC command\n\n @ingroup osc"]
    pub fn ghostty_osc_end(parser: GhosttyOscParser_ptr, terminator: u8) -> GhosttyOscCommand_ptr;
}
unsafe extern "C" {
    #[doc = " Get the type of an OSC command.\n\n Returns the type identifier for the given OSC command. This can be used\n to determine what kind of command was parsed and what data might be\n available from it.\n\n @param command The OSC command handle to query (may be NULL)\n @return The command type, or GHOSTTY_OSC_COMMAND_INVALID if command is NULL\n\n @ingroup osc"]
    pub fn ghostty_osc_command_type(command: GhosttyOscCommand_ptr) -> GhosttyOscCommandType;
}
unsafe extern "C" {
    #[doc = " Extract data from an OSC command.\n\n Extracts typed data from the given OSC command based on the specified\n data type. The output pointer must be of the appropriate type for the\n requested data kind. Valid command types, output types, and memory\n safety information are documented in the `GhosttyOscCommandData` enum.\n\n @param command The OSC command handle to query (may be NULL)\n @param data The type of data to extract\n @param out Pointer to store the extracted data (type depends on data parameter)\n @return true if data extraction was successful, false otherwise\n\n @ingroup osc"]
    pub fn ghostty_osc_command_data(
        command: GhosttyOscCommand_ptr,
        data: GhosttyOscCommandData,
        out: *mut ::std::os::raw::c_void,
    ) -> bool;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttySgrParser {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to an SGR parser instance.\n\n This handle represents an SGR (Select Graphic Rendition) parser that can\n be used to parse SGR sequences and extract individual text attributes.\n\n @ingroup sgr"]
pub type GhosttySgrParser_ptr = *mut GhosttySgrParser;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNSET: GhosttySgrAttributeTag = 0;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNKNOWN: GhosttySgrAttributeTag = 1;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BOLD: GhosttySgrAttributeTag = 2;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_BOLD: GhosttySgrAttributeTag = 3;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_ITALIC: GhosttySgrAttributeTag = 4;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_ITALIC: GhosttySgrAttributeTag = 5;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_FAINT: GhosttySgrAttributeTag = 6;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNDERLINE: GhosttySgrAttributeTag = 7;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNDERLINE_COLOR: GhosttySgrAttributeTag = 8;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_UNDERLINE_COLOR_256: GhosttySgrAttributeTag = 9;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_UNDERLINE_COLOR: GhosttySgrAttributeTag =
    10;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_OVERLINE: GhosttySgrAttributeTag = 11;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_OVERLINE: GhosttySgrAttributeTag = 12;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BLINK: GhosttySgrAttributeTag = 13;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_BLINK: GhosttySgrAttributeTag = 14;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_INVERSE: GhosttySgrAttributeTag = 15;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_INVERSE: GhosttySgrAttributeTag = 16;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_INVISIBLE: GhosttySgrAttributeTag = 17;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_INVISIBLE: GhosttySgrAttributeTag = 18;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_STRIKETHROUGH: GhosttySgrAttributeTag = 19;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_STRIKETHROUGH: GhosttySgrAttributeTag = 20;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_DIRECT_COLOR_FG: GhosttySgrAttributeTag = 21;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_DIRECT_COLOR_BG: GhosttySgrAttributeTag = 22;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BG_8: GhosttySgrAttributeTag = 23;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_FG_8: GhosttySgrAttributeTag = 24;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_FG: GhosttySgrAttributeTag = 25;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_RESET_BG: GhosttySgrAttributeTag = 26;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BRIGHT_BG_8: GhosttySgrAttributeTag = 27;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BRIGHT_FG_8: GhosttySgrAttributeTag = 28;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_BG_256: GhosttySgrAttributeTag = 29;
pub const GhosttySgrAttributeTag_GHOSTTY_SGR_ATTR_FG_256: GhosttySgrAttributeTag = 30;
#[doc = " SGR attribute tags.\n\n These values identify the type of an SGR attribute in a tagged union.\n Use the tag to determine which field in the attribute value union to access.\n\n @ingroup sgr"]
pub type GhosttySgrAttributeTag = ::std::os::raw::c_uint;
pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_NONE: GhosttySgrUnderline = 0;
pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_SINGLE: GhosttySgrUnderline = 1;
pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_DOUBLE: GhosttySgrUnderline = 2;
pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_CURLY: GhosttySgrUnderline = 3;
pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_DOTTED: GhosttySgrUnderline = 4;
pub const GhosttySgrUnderline_GHOSTTY_SGR_UNDERLINE_DASHED: GhosttySgrUnderline = 5;
#[doc = " Underline style types.\n\n @ingroup sgr"]
pub type GhosttySgrUnderline = ::std::os::raw::c_uint;
#[doc = " Unknown SGR attribute data.\n\n Contains the full parameter list and the partial list where parsing\n encountered an unknown or invalid sequence.\n\n @ingroup sgr"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttySgrUnknown {
    pub full_ptr: *const u16,
    pub full_len: usize,
    pub partial_ptr: *const u16,
    pub partial_len: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttySgrUnknown"][::std::mem::size_of::<GhosttySgrUnknown>() - 32usize];
    ["Alignment of GhosttySgrUnknown"][::std::mem::align_of::<GhosttySgrUnknown>() - 8usize];
    ["Offset of field: GhosttySgrUnknown::full_ptr"]
        [::std::mem::offset_of!(GhosttySgrUnknown, full_ptr) - 0usize];
    ["Offset of field: GhosttySgrUnknown::full_len"]
        [::std::mem::offset_of!(GhosttySgrUnknown, full_len) - 8usize];
    ["Offset of field: GhosttySgrUnknown::partial_ptr"]
        [::std::mem::offset_of!(GhosttySgrUnknown, partial_ptr) - 16usize];
    ["Offset of field: GhosttySgrUnknown::partial_len"]
        [::std::mem::offset_of!(GhosttySgrUnknown, partial_len) - 24usize];
};
impl Default for GhosttySgrUnknown {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " SGR attribute value union.\n\n This union contains all possible attribute values. Use the tag field\n to determine which union member is active. Attributes without associated\n data (like bold, italic) don't use the union value.\n\n @ingroup sgr"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union GhosttySgrAttributeValue {
    pub unknown: GhosttySgrUnknown,
    pub underline: GhosttySgrUnderline,
    pub underline_color: GhosttyColorRgb,
    pub underline_color_256: GhosttyColorPaletteIndex,
    pub direct_color_fg: GhosttyColorRgb,
    pub direct_color_bg: GhosttyColorRgb,
    pub bg_8: GhosttyColorPaletteIndex,
    pub fg_8: GhosttyColorPaletteIndex,
    pub bright_bg_8: GhosttyColorPaletteIndex,
    pub bright_fg_8: GhosttyColorPaletteIndex,
    pub bg_256: GhosttyColorPaletteIndex,
    pub fg_256: GhosttyColorPaletteIndex,
    pub _padding: [u64; 8usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttySgrAttributeValue"]
        [::std::mem::size_of::<GhosttySgrAttributeValue>() - 64usize];
    ["Alignment of GhosttySgrAttributeValue"]
        [::std::mem::align_of::<GhosttySgrAttributeValue>() - 8usize];
    ["Offset of field: GhosttySgrAttributeValue::unknown"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, unknown) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::underline"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, underline) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::underline_color"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, underline_color) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::underline_color_256"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, underline_color_256) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::direct_color_fg"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, direct_color_fg) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::direct_color_bg"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, direct_color_bg) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::bg_8"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, bg_8) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::fg_8"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, fg_8) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::bright_bg_8"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, bright_bg_8) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::bright_fg_8"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, bright_fg_8) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::bg_256"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, bg_256) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::fg_256"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, fg_256) - 0usize];
    ["Offset of field: GhosttySgrAttributeValue::_padding"]
        [::std::mem::offset_of!(GhosttySgrAttributeValue, _padding) - 0usize];
};
impl Default for GhosttySgrAttributeValue {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " SGR attribute (tagged union).\n\n A complete SGR attribute with both its type tag and associated value.\n Always check the tag field to determine which value union member is valid.\n\n Attributes without associated data (e.g., GHOSTTY_SGR_ATTR_BOLD) can be\n identified by tag alone; the value union is not used for these and\n the memory in the value field is undefined.\n\n @ingroup sgr"]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GhosttySgrAttribute {
    pub tag: GhosttySgrAttributeTag,
    pub value: GhosttySgrAttributeValue,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttySgrAttribute"][::std::mem::size_of::<GhosttySgrAttribute>() - 72usize];
    ["Alignment of GhosttySgrAttribute"][::std::mem::align_of::<GhosttySgrAttribute>() - 8usize];
    ["Offset of field: GhosttySgrAttribute::tag"]
        [::std::mem::offset_of!(GhosttySgrAttribute, tag) - 0usize];
    ["Offset of field: GhosttySgrAttribute::value"]
        [::std::mem::offset_of!(GhosttySgrAttribute, value) - 8usize];
};
impl Default for GhosttySgrAttribute {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
unsafe extern "C" {
    #[doc = " Create a new SGR parser instance.\n\n Creates a new SGR (Select Graphic Rendition) parser using the provided\n allocator. The parser must be freed using ghostty_sgr_free() when\n no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or\n NULL to use the default allocator\n @param parser Pointer to store the created parser handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup sgr"]
    pub fn ghostty_sgr_new(
        allocator: *const GhosttyAllocator,
        parser: *mut GhosttySgrParser_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free an SGR parser instance.\n\n Releases all resources associated with the SGR parser. After this call,\n the parser handle becomes invalid and must not be used. This includes\n any attributes previously returned by ghostty_sgr_next().\n\n @param parser The parser handle to free (may be NULL)\n\n @ingroup sgr"]
    pub fn ghostty_sgr_free(parser: GhosttySgrParser_ptr);
}
unsafe extern "C" {
    #[doc = " Reset an SGR parser instance to the beginning of the parameter list.\n\n Resets the parser's iteration state without clearing the parameters.\n After calling this, ghostty_sgr_next() will start from the beginning\n of the parameter list again.\n\n @param parser The parser handle to reset, must not be NULL\n\n @ingroup sgr"]
    pub fn ghostty_sgr_reset(parser: GhosttySgrParser_ptr);
}
unsafe extern "C" {
    #[doc = " Set SGR parameters for parsing.\n\n Sets the SGR parameter list to parse. Parameters are the numeric values\n from a CSI SGR sequence (e.g., for `ESC[1;31m`, params would be {1, 31}).\n\n The separators array optionally specifies the separator type for each\n parameter position. Each byte should be either ';' for semicolon or ':'\n for colon. This is needed for certain color formats that use colon\n separators (e.g., `ESC[4:3m` for curly underline). Any invalid separator\n values are treated as semicolons. The separators array must have the same\n length as the params array, if it is not NULL.\n\n If separators is NULL, all parameters are assumed to be semicolon-separated.\n\n This function makes an internal copy of the parameter and separator data,\n so the caller can safely free or modify the input arrays after this call.\n\n After calling this function, the parser is automatically reset and ready\n to iterate from the beginning.\n\n @param parser The parser handle, must not be NULL\n @param params Array of SGR parameter values\n @param separators Optional array of separator characters (';' or ':'), or\n NULL\n @param len Number of parameters (and separators if provided)\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup sgr"]
    pub fn ghostty_sgr_set_params(
        parser: GhosttySgrParser_ptr,
        params: *const u16,
        separators: *const ::std::os::raw::c_char,
        len: usize,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Get the next SGR attribute.\n\n Parses and returns the next attribute from the parameter list.\n Call this function repeatedly until it returns false to process\n all attributes in the sequence.\n\n @param parser The parser handle, must not be NULL\n @param attr Pointer to store the next attribute\n @return true if an attribute was returned, false if no more attributes\n\n @ingroup sgr"]
    pub fn ghostty_sgr_next(parser: GhosttySgrParser_ptr, attr: *mut GhosttySgrAttribute) -> bool;
}
unsafe extern "C" {
    #[doc = " Get the full parameter list from an unknown SGR attribute.\n\n This function retrieves the full parameter list that was provided to the\n parser when an unknown attribute was encountered. Primarily useful in\n WebAssembly environments where accessing struct fields directly is difficult.\n\n @param unknown The unknown attribute data\n @param ptr Pointer to store the pointer to the parameter array (may be NULL)\n @return The length of the full parameter array\n\n @ingroup sgr"]
    pub fn ghostty_sgr_unknown_full(unknown: GhosttySgrUnknown, ptr: *mut *const u16) -> usize;
}
unsafe extern "C" {
    #[doc = " Get the partial parameter list from an unknown SGR attribute.\n\n This function retrieves the partial parameter list where parsing stopped\n when an unknown attribute was encountered. Primarily useful in WebAssembly\n environments where accessing struct fields directly is difficult.\n\n @param unknown The unknown attribute data\n @param ptr Pointer to store the pointer to the parameter array (may be NULL)\n @return The length of the partial parameter array\n\n @ingroup sgr"]
    pub fn ghostty_sgr_unknown_partial(unknown: GhosttySgrUnknown, ptr: *mut *const u16) -> usize;
}
unsafe extern "C" {
    #[doc = " Get the tag from an SGR attribute.\n\n This function extracts the tag that identifies which type of attribute\n this is. Primarily useful in WebAssembly environments where accessing\n struct fields directly is difficult.\n\n @param attr The SGR attribute\n @return The attribute tag\n\n @ingroup sgr"]
    pub fn ghostty_sgr_attribute_tag(attr: GhosttySgrAttribute) -> GhosttySgrAttributeTag;
}
unsafe extern "C" {
    #[doc = " Get the value from an SGR attribute.\n\n This function returns a pointer to the value union from an SGR attribute. Use\n the tag to determine which field of the union is valid. Primarily useful in\n WebAssembly environments where accessing struct fields directly is difficult.\n\n @param attr Pointer to the SGR attribute\n @return Pointer to the attribute value union\n\n @ingroup sgr"]
    pub fn ghostty_sgr_attribute_value(
        attr: *mut GhosttySgrAttribute,
    ) -> *mut GhosttySgrAttributeValue;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyKeyEvent {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a key event.\n\n This handle represents a keyboard input event containing information about\n the physical key pressed, modifiers, and generated text.\n\n @ingroup key"]
pub type GhosttyKeyEvent_ptr = *mut GhosttyKeyEvent;
#[doc = " Key was released"]
pub const GhosttyKeyAction_GHOSTTY_KEY_ACTION_RELEASE: GhosttyKeyAction = 0;
#[doc = " Key was pressed"]
pub const GhosttyKeyAction_GHOSTTY_KEY_ACTION_PRESS: GhosttyKeyAction = 1;
#[doc = " Key is being repeated (held down)"]
pub const GhosttyKeyAction_GHOSTTY_KEY_ACTION_REPEAT: GhosttyKeyAction = 2;
#[doc = " Keyboard input event types.\n\n @ingroup key"]
pub type GhosttyKeyAction = ::std::os::raw::c_uint;
#[doc = " Keyboard modifier keys bitmask.\n\n A bitmask representing all keyboard modifiers. This tracks which modifier keys\n are pressed and, where supported by the platform, which side (left or right)\n of each modifier is active.\n\n Use the GHOSTTY_MODS_* constants to test and set individual modifiers.\n\n Modifier side bits are only meaningful when the corresponding modifier bit is set.\n Not all platforms support distinguishing between left and right modifier\n keys and Ghostty is built to expect that some platforms may not provide this\n information.\n\n @ingroup key"]
pub type GhosttyMods = u16;
pub const GhosttyKey_GHOSTTY_KEY_UNIDENTIFIED: GhosttyKey = 0;
pub const GhosttyKey_GHOSTTY_KEY_BACKQUOTE: GhosttyKey = 1;
pub const GhosttyKey_GHOSTTY_KEY_BACKSLASH: GhosttyKey = 2;
pub const GhosttyKey_GHOSTTY_KEY_BRACKET_LEFT: GhosttyKey = 3;
pub const GhosttyKey_GHOSTTY_KEY_BRACKET_RIGHT: GhosttyKey = 4;
pub const GhosttyKey_GHOSTTY_KEY_COMMA: GhosttyKey = 5;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_0: GhosttyKey = 6;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_1: GhosttyKey = 7;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_2: GhosttyKey = 8;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_3: GhosttyKey = 9;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_4: GhosttyKey = 10;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_5: GhosttyKey = 11;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_6: GhosttyKey = 12;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_7: GhosttyKey = 13;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_8: GhosttyKey = 14;
pub const GhosttyKey_GHOSTTY_KEY_DIGIT_9: GhosttyKey = 15;
pub const GhosttyKey_GHOSTTY_KEY_EQUAL: GhosttyKey = 16;
pub const GhosttyKey_GHOSTTY_KEY_INTL_BACKSLASH: GhosttyKey = 17;
pub const GhosttyKey_GHOSTTY_KEY_INTL_RO: GhosttyKey = 18;
pub const GhosttyKey_GHOSTTY_KEY_INTL_YEN: GhosttyKey = 19;
pub const GhosttyKey_GHOSTTY_KEY_A: GhosttyKey = 20;
pub const GhosttyKey_GHOSTTY_KEY_B: GhosttyKey = 21;
pub const GhosttyKey_GHOSTTY_KEY_C: GhosttyKey = 22;
pub const GhosttyKey_GHOSTTY_KEY_D: GhosttyKey = 23;
pub const GhosttyKey_GHOSTTY_KEY_E: GhosttyKey = 24;
pub const GhosttyKey_GHOSTTY_KEY_F: GhosttyKey = 25;
pub const GhosttyKey_GHOSTTY_KEY_G: GhosttyKey = 26;
pub const GhosttyKey_GHOSTTY_KEY_H: GhosttyKey = 27;
pub const GhosttyKey_GHOSTTY_KEY_I: GhosttyKey = 28;
pub const GhosttyKey_GHOSTTY_KEY_J: GhosttyKey = 29;
pub const GhosttyKey_GHOSTTY_KEY_K: GhosttyKey = 30;
pub const GhosttyKey_GHOSTTY_KEY_L: GhosttyKey = 31;
pub const GhosttyKey_GHOSTTY_KEY_M: GhosttyKey = 32;
pub const GhosttyKey_GHOSTTY_KEY_N: GhosttyKey = 33;
pub const GhosttyKey_GHOSTTY_KEY_O: GhosttyKey = 34;
pub const GhosttyKey_GHOSTTY_KEY_P: GhosttyKey = 35;
pub const GhosttyKey_GHOSTTY_KEY_Q: GhosttyKey = 36;
pub const GhosttyKey_GHOSTTY_KEY_R: GhosttyKey = 37;
pub const GhosttyKey_GHOSTTY_KEY_S: GhosttyKey = 38;
pub const GhosttyKey_GHOSTTY_KEY_T: GhosttyKey = 39;
pub const GhosttyKey_GHOSTTY_KEY_U: GhosttyKey = 40;
pub const GhosttyKey_GHOSTTY_KEY_V: GhosttyKey = 41;
pub const GhosttyKey_GHOSTTY_KEY_W: GhosttyKey = 42;
pub const GhosttyKey_GHOSTTY_KEY_X: GhosttyKey = 43;
pub const GhosttyKey_GHOSTTY_KEY_Y: GhosttyKey = 44;
pub const GhosttyKey_GHOSTTY_KEY_Z: GhosttyKey = 45;
pub const GhosttyKey_GHOSTTY_KEY_MINUS: GhosttyKey = 46;
pub const GhosttyKey_GHOSTTY_KEY_PERIOD: GhosttyKey = 47;
pub const GhosttyKey_GHOSTTY_KEY_QUOTE: GhosttyKey = 48;
pub const GhosttyKey_GHOSTTY_KEY_SEMICOLON: GhosttyKey = 49;
pub const GhosttyKey_GHOSTTY_KEY_SLASH: GhosttyKey = 50;
pub const GhosttyKey_GHOSTTY_KEY_ALT_LEFT: GhosttyKey = 51;
pub const GhosttyKey_GHOSTTY_KEY_ALT_RIGHT: GhosttyKey = 52;
pub const GhosttyKey_GHOSTTY_KEY_BACKSPACE: GhosttyKey = 53;
pub const GhosttyKey_GHOSTTY_KEY_CAPS_LOCK: GhosttyKey = 54;
pub const GhosttyKey_GHOSTTY_KEY_CONTEXT_MENU: GhosttyKey = 55;
pub const GhosttyKey_GHOSTTY_KEY_CONTROL_LEFT: GhosttyKey = 56;
pub const GhosttyKey_GHOSTTY_KEY_CONTROL_RIGHT: GhosttyKey = 57;
pub const GhosttyKey_GHOSTTY_KEY_ENTER: GhosttyKey = 58;
pub const GhosttyKey_GHOSTTY_KEY_META_LEFT: GhosttyKey = 59;
pub const GhosttyKey_GHOSTTY_KEY_META_RIGHT: GhosttyKey = 60;
pub const GhosttyKey_GHOSTTY_KEY_SHIFT_LEFT: GhosttyKey = 61;
pub const GhosttyKey_GHOSTTY_KEY_SHIFT_RIGHT: GhosttyKey = 62;
pub const GhosttyKey_GHOSTTY_KEY_SPACE: GhosttyKey = 63;
pub const GhosttyKey_GHOSTTY_KEY_TAB: GhosttyKey = 64;
pub const GhosttyKey_GHOSTTY_KEY_CONVERT: GhosttyKey = 65;
pub const GhosttyKey_GHOSTTY_KEY_KANA_MODE: GhosttyKey = 66;
pub const GhosttyKey_GHOSTTY_KEY_NON_CONVERT: GhosttyKey = 67;
pub const GhosttyKey_GHOSTTY_KEY_DELETE: GhosttyKey = 68;
pub const GhosttyKey_GHOSTTY_KEY_END: GhosttyKey = 69;
pub const GhosttyKey_GHOSTTY_KEY_HELP: GhosttyKey = 70;
pub const GhosttyKey_GHOSTTY_KEY_HOME: GhosttyKey = 71;
pub const GhosttyKey_GHOSTTY_KEY_INSERT: GhosttyKey = 72;
pub const GhosttyKey_GHOSTTY_KEY_PAGE_DOWN: GhosttyKey = 73;
pub const GhosttyKey_GHOSTTY_KEY_PAGE_UP: GhosttyKey = 74;
pub const GhosttyKey_GHOSTTY_KEY_ARROW_DOWN: GhosttyKey = 75;
pub const GhosttyKey_GHOSTTY_KEY_ARROW_LEFT: GhosttyKey = 76;
pub const GhosttyKey_GHOSTTY_KEY_ARROW_RIGHT: GhosttyKey = 77;
pub const GhosttyKey_GHOSTTY_KEY_ARROW_UP: GhosttyKey = 78;
pub const GhosttyKey_GHOSTTY_KEY_NUM_LOCK: GhosttyKey = 79;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_0: GhosttyKey = 80;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_1: GhosttyKey = 81;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_2: GhosttyKey = 82;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_3: GhosttyKey = 83;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_4: GhosttyKey = 84;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_5: GhosttyKey = 85;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_6: GhosttyKey = 86;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_7: GhosttyKey = 87;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_8: GhosttyKey = 88;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_9: GhosttyKey = 89;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_ADD: GhosttyKey = 90;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_BACKSPACE: GhosttyKey = 91;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_CLEAR: GhosttyKey = 92;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_CLEAR_ENTRY: GhosttyKey = 93;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_COMMA: GhosttyKey = 94;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DECIMAL: GhosttyKey = 95;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DIVIDE: GhosttyKey = 96;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_ENTER: GhosttyKey = 97;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_EQUAL: GhosttyKey = 98;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_ADD: GhosttyKey = 99;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_CLEAR: GhosttyKey = 100;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_RECALL: GhosttyKey = 101;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_STORE: GhosttyKey = 102;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MEMORY_SUBTRACT: GhosttyKey = 103;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_MULTIPLY: GhosttyKey = 104;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAREN_LEFT: GhosttyKey = 105;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAREN_RIGHT: GhosttyKey = 106;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_SUBTRACT: GhosttyKey = 107;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_SEPARATOR: GhosttyKey = 108;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_UP: GhosttyKey = 109;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DOWN: GhosttyKey = 110;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_RIGHT: GhosttyKey = 111;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_LEFT: GhosttyKey = 112;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_BEGIN: GhosttyKey = 113;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_HOME: GhosttyKey = 114;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_END: GhosttyKey = 115;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_INSERT: GhosttyKey = 116;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_DELETE: GhosttyKey = 117;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAGE_UP: GhosttyKey = 118;
pub const GhosttyKey_GHOSTTY_KEY_NUMPAD_PAGE_DOWN: GhosttyKey = 119;
pub const GhosttyKey_GHOSTTY_KEY_ESCAPE: GhosttyKey = 120;
pub const GhosttyKey_GHOSTTY_KEY_F1: GhosttyKey = 121;
pub const GhosttyKey_GHOSTTY_KEY_F2: GhosttyKey = 122;
pub const GhosttyKey_GHOSTTY_KEY_F3: GhosttyKey = 123;
pub const GhosttyKey_GHOSTTY_KEY_F4: GhosttyKey = 124;
pub const GhosttyKey_GHOSTTY_KEY_F5: GhosttyKey = 125;
pub const GhosttyKey_GHOSTTY_KEY_F6: GhosttyKey = 126;
pub const GhosttyKey_GHOSTTY_KEY_F7: GhosttyKey = 127;
pub const GhosttyKey_GHOSTTY_KEY_F8: GhosttyKey = 128;
pub const GhosttyKey_GHOSTTY_KEY_F9: GhosttyKey = 129;
pub const GhosttyKey_GHOSTTY_KEY_F10: GhosttyKey = 130;
pub const GhosttyKey_GHOSTTY_KEY_F11: GhosttyKey = 131;
pub const GhosttyKey_GHOSTTY_KEY_F12: GhosttyKey = 132;
pub const GhosttyKey_GHOSTTY_KEY_F13: GhosttyKey = 133;
pub const GhosttyKey_GHOSTTY_KEY_F14: GhosttyKey = 134;
pub const GhosttyKey_GHOSTTY_KEY_F15: GhosttyKey = 135;
pub const GhosttyKey_GHOSTTY_KEY_F16: GhosttyKey = 136;
pub const GhosttyKey_GHOSTTY_KEY_F17: GhosttyKey = 137;
pub const GhosttyKey_GHOSTTY_KEY_F18: GhosttyKey = 138;
pub const GhosttyKey_GHOSTTY_KEY_F19: GhosttyKey = 139;
pub const GhosttyKey_GHOSTTY_KEY_F20: GhosttyKey = 140;
pub const GhosttyKey_GHOSTTY_KEY_F21: GhosttyKey = 141;
pub const GhosttyKey_GHOSTTY_KEY_F22: GhosttyKey = 142;
pub const GhosttyKey_GHOSTTY_KEY_F23: GhosttyKey = 143;
pub const GhosttyKey_GHOSTTY_KEY_F24: GhosttyKey = 144;
pub const GhosttyKey_GHOSTTY_KEY_F25: GhosttyKey = 145;
pub const GhosttyKey_GHOSTTY_KEY_FN: GhosttyKey = 146;
pub const GhosttyKey_GHOSTTY_KEY_FN_LOCK: GhosttyKey = 147;
pub const GhosttyKey_GHOSTTY_KEY_PRINT_SCREEN: GhosttyKey = 148;
pub const GhosttyKey_GHOSTTY_KEY_SCROLL_LOCK: GhosttyKey = 149;
pub const GhosttyKey_GHOSTTY_KEY_PAUSE: GhosttyKey = 150;
pub const GhosttyKey_GHOSTTY_KEY_BROWSER_BACK: GhosttyKey = 151;
pub const GhosttyKey_GHOSTTY_KEY_BROWSER_FAVORITES: GhosttyKey = 152;
pub const GhosttyKey_GHOSTTY_KEY_BROWSER_FORWARD: GhosttyKey = 153;
pub const GhosttyKey_GHOSTTY_KEY_BROWSER_HOME: GhosttyKey = 154;
pub const GhosttyKey_GHOSTTY_KEY_BROWSER_REFRESH: GhosttyKey = 155;
pub const GhosttyKey_GHOSTTY_KEY_BROWSER_SEARCH: GhosttyKey = 156;
pub const GhosttyKey_GHOSTTY_KEY_BROWSER_STOP: GhosttyKey = 157;
pub const GhosttyKey_GHOSTTY_KEY_EJECT: GhosttyKey = 158;
pub const GhosttyKey_GHOSTTY_KEY_LAUNCH_APP_1: GhosttyKey = 159;
pub const GhosttyKey_GHOSTTY_KEY_LAUNCH_APP_2: GhosttyKey = 160;
pub const GhosttyKey_GHOSTTY_KEY_LAUNCH_MAIL: GhosttyKey = 161;
pub const GhosttyKey_GHOSTTY_KEY_MEDIA_PLAY_PAUSE: GhosttyKey = 162;
pub const GhosttyKey_GHOSTTY_KEY_MEDIA_SELECT: GhosttyKey = 163;
pub const GhosttyKey_GHOSTTY_KEY_MEDIA_STOP: GhosttyKey = 164;
pub const GhosttyKey_GHOSTTY_KEY_MEDIA_TRACK_NEXT: GhosttyKey = 165;
pub const GhosttyKey_GHOSTTY_KEY_MEDIA_TRACK_PREVIOUS: GhosttyKey = 166;
pub const GhosttyKey_GHOSTTY_KEY_POWER: GhosttyKey = 167;
pub const GhosttyKey_GHOSTTY_KEY_SLEEP: GhosttyKey = 168;
pub const GhosttyKey_GHOSTTY_KEY_AUDIO_VOLUME_DOWN: GhosttyKey = 169;
pub const GhosttyKey_GHOSTTY_KEY_AUDIO_VOLUME_MUTE: GhosttyKey = 170;
pub const GhosttyKey_GHOSTTY_KEY_AUDIO_VOLUME_UP: GhosttyKey = 171;
pub const GhosttyKey_GHOSTTY_KEY_WAKE_UP: GhosttyKey = 172;
pub const GhosttyKey_GHOSTTY_KEY_COPY: GhosttyKey = 173;
pub const GhosttyKey_GHOSTTY_KEY_CUT: GhosttyKey = 174;
pub const GhosttyKey_GHOSTTY_KEY_PASTE: GhosttyKey = 175;
#[doc = " Physical key codes.\n\n The set of key codes that Ghostty is aware of. These represent physical keys\n on the keyboard and are layout-independent. For example, the \"a\" key on a US\n keyboard is the same as the \"ф\" key on a Russian keyboard, but both will\n report the same key_a value.\n\n Layout-dependent strings are provided separately as UTF-8 text and are produced\n by the platform. These values are based on the W3C UI Events KeyboardEvent code\n standard. See: https://www.w3.org/TR/uievents-code\n\n @ingroup key"]
pub type GhosttyKey = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Create a new key event instance.\n\n Creates a new key event with default values. The event must be freed using\n ghostty_key_event_free() when no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator\n @param event Pointer to store the created key event handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup key"]
    pub fn ghostty_key_event_new(
        allocator: *const GhosttyAllocator,
        event: *mut GhosttyKeyEvent_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a key event instance.\n\n Releases all resources associated with the key event. After this call,\n the event handle becomes invalid and must not be used.\n\n @param event The key event handle to free (may be NULL)\n\n @ingroup key"]
    pub fn ghostty_key_event_free(event: GhosttyKeyEvent_ptr);
}
unsafe extern "C" {
    #[doc = " Set the key action (press, release, repeat).\n\n @param event The key event handle, must not be NULL\n @param action The action to set\n\n @ingroup key"]
    pub fn ghostty_key_event_set_action(event: GhosttyKeyEvent_ptr, action: GhosttyKeyAction);
}
unsafe extern "C" {
    #[doc = " Get the key action (press, release, repeat).\n\n @param event The key event handle, must not be NULL\n @return The key action\n\n @ingroup key"]
    pub fn ghostty_key_event_get_action(event: GhosttyKeyEvent_ptr) -> GhosttyKeyAction;
}
unsafe extern "C" {
    #[doc = " Set the physical key code.\n\n @param event The key event handle, must not be NULL\n @param key The physical key code to set\n\n @ingroup key"]
    pub fn ghostty_key_event_set_key(event: GhosttyKeyEvent_ptr, key: GhosttyKey);
}
unsafe extern "C" {
    #[doc = " Get the physical key code.\n\n @param event The key event handle, must not be NULL\n @return The physical key code\n\n @ingroup key"]
    pub fn ghostty_key_event_get_key(event: GhosttyKeyEvent_ptr) -> GhosttyKey;
}
unsafe extern "C" {
    #[doc = " Set the modifier keys bitmask.\n\n @param event The key event handle, must not be NULL\n @param mods The modifier keys bitmask to set\n\n @ingroup key"]
    pub fn ghostty_key_event_set_mods(event: GhosttyKeyEvent_ptr, mods: GhosttyMods);
}
unsafe extern "C" {
    #[doc = " Get the modifier keys bitmask.\n\n @param event The key event handle, must not be NULL\n @return The modifier keys bitmask\n\n @ingroup key"]
    pub fn ghostty_key_event_get_mods(event: GhosttyKeyEvent_ptr) -> GhosttyMods;
}
unsafe extern "C" {
    #[doc = " Set the consumed modifiers bitmask.\n\n @param event The key event handle, must not be NULL\n @param consumed_mods The consumed modifiers bitmask to set\n\n @ingroup key"]
    pub fn ghostty_key_event_set_consumed_mods(
        event: GhosttyKeyEvent_ptr,
        consumed_mods: GhosttyMods,
    );
}
unsafe extern "C" {
    #[doc = " Get the consumed modifiers bitmask.\n\n @param event The key event handle, must not be NULL\n @return The consumed modifiers bitmask\n\n @ingroup key"]
    pub fn ghostty_key_event_get_consumed_mods(event: GhosttyKeyEvent_ptr) -> GhosttyMods;
}
unsafe extern "C" {
    #[doc = " Set whether the key event is part of a composition sequence.\n\n @param event The key event handle, must not be NULL\n @param composing Whether the key event is part of a composition sequence\n\n @ingroup key"]
    pub fn ghostty_key_event_set_composing(event: GhosttyKeyEvent_ptr, composing: bool);
}
unsafe extern "C" {
    #[doc = " Get whether the key event is part of a composition sequence.\n\n @param event The key event handle, must not be NULL\n @return Whether the key event is part of a composition sequence\n\n @ingroup key"]
    pub fn ghostty_key_event_get_composing(event: GhosttyKeyEvent_ptr) -> bool;
}
unsafe extern "C" {
    #[doc = " Set the UTF-8 text generated by the key event.\n\n The key event does NOT take ownership of the text pointer. The caller\n must ensure the string remains valid for the lifetime needed by the event.\n\n @param event The key event handle, must not be NULL\n @param utf8 The UTF-8 text to set (or NULL for empty)\n @param len Length of the UTF-8 text in bytes\n\n @ingroup key"]
    pub fn ghostty_key_event_set_utf8(
        event: GhosttyKeyEvent_ptr,
        utf8: *const ::std::os::raw::c_char,
        len: usize,
    );
}
unsafe extern "C" {
    #[doc = " Get the UTF-8 text generated by the key event.\n\n The returned pointer is valid until the event is freed or the UTF-8 text is modified.\n\n @param event The key event handle, must not be NULL\n @param len Pointer to store the length of the UTF-8 text in bytes (may be NULL)\n @return The UTF-8 text (or NULL for empty)\n\n @ingroup key"]
    pub fn ghostty_key_event_get_utf8(
        event: GhosttyKeyEvent_ptr,
        len: *mut usize,
    ) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
    #[doc = " Set the unshifted Unicode codepoint.\n\n @param event The key event handle, must not be NULL\n @param codepoint The unshifted Unicode codepoint to set\n\n @ingroup key"]
    pub fn ghostty_key_event_set_unshifted_codepoint(event: GhosttyKeyEvent_ptr, codepoint: u32);
}
unsafe extern "C" {
    #[doc = " Get the unshifted Unicode codepoint.\n\n @param event The key event handle, must not be NULL\n @return The unshifted Unicode codepoint\n\n @ingroup key"]
    pub fn ghostty_key_event_get_unshifted_codepoint(event: GhosttyKeyEvent_ptr) -> u32;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyKeyEncoder {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a key encoder instance.\n\n This handle represents a key encoder that converts key events into terminal\n escape sequences.\n\n @ingroup key"]
pub type GhosttyKeyEncoder_ptr = *mut GhosttyKeyEncoder;
#[doc = " Kitty keyboard protocol flags.\n\n Bitflags representing the various modes of the Kitty keyboard protocol.\n These can be combined using bitwise OR operations. Valid values all\n start with `GHOSTTY_KITTY_KEY_`.\n\n @ingroup key"]
pub type GhosttyKittyKeyFlags = u8;
#[doc = " Option key is not treated as alt"]
pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_FALSE: GhosttyOptionAsAlt = 0;
#[doc = " Option key is treated as alt"]
pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_TRUE: GhosttyOptionAsAlt = 1;
#[doc = " Only left option key is treated as alt"]
pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_LEFT: GhosttyOptionAsAlt = 2;
#[doc = " Only right option key is treated as alt"]
pub const GhosttyOptionAsAlt_GHOSTTY_OPTION_AS_ALT_RIGHT: GhosttyOptionAsAlt = 3;
#[doc = " macOS option key behavior.\n\n Determines whether the \"option\" key on macOS is treated as \"alt\" or not.\n See the Ghostty `macos-option-as-alt` configuration option for more details.\n\n @ingroup key"]
pub type GhosttyOptionAsAlt = ::std::os::raw::c_uint;
#[doc = " Terminal DEC mode 1: cursor key application mode (value: bool)"]
pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION:
    GhosttyKeyEncoderOption = 0;
#[doc = " Terminal DEC mode 66: keypad key application mode (value: bool)"]
pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION:
    GhosttyKeyEncoderOption = 1;
#[doc = " Terminal DEC mode 1035: ignore keypad with numlock (value: bool)"]
pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK:
    GhosttyKeyEncoderOption = 2;
#[doc = " Terminal DEC mode 1036: alt sends escape prefix (value: bool)"]
pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX: GhosttyKeyEncoderOption =
    3;
#[doc = " xterm modifyOtherKeys mode 2 (value: bool)"]
pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2:
    GhosttyKeyEncoderOption = 4;
#[doc = " Kitty keyboard protocol flags (value: GhosttyKittyKeyFlags bitmask)"]
pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS: GhosttyKeyEncoderOption = 5;
#[doc = " macOS option-as-alt setting (value: GhosttyOptionAsAlt)"]
pub const GhosttyKeyEncoderOption_GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT:
    GhosttyKeyEncoderOption = 6;
#[doc = " Key encoder option identifiers.\n\n These values are used with ghostty_key_encoder_setopt() to configure\n the behavior of the key encoder.\n\n @ingroup key"]
pub type GhosttyKeyEncoderOption = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Create a new key encoder instance.\n\n Creates a new key encoder with default options. The encoder can be configured\n using ghostty_key_encoder_setopt() and must be freed using\n ghostty_key_encoder_free() when no longer needed.\n\n @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator\n @param encoder Pointer to store the created encoder handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup key"]
    pub fn ghostty_key_encoder_new(
        allocator: *const GhosttyAllocator,
        encoder: *mut GhosttyKeyEncoder_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a key encoder instance.\n\n Releases all resources associated with the key encoder. After this call,\n the encoder handle becomes invalid and must not be used.\n\n @param encoder The encoder handle to free (may be NULL)\n\n @ingroup key"]
    pub fn ghostty_key_encoder_free(encoder: GhosttyKeyEncoder_ptr);
}
unsafe extern "C" {
    #[doc = " Set an option on the key encoder.\n\n Configures the behavior of the key encoder. Options control various aspects\n of encoding such as terminal modes (cursor key application mode, keypad mode),\n protocol selection (Kitty keyboard protocol flags), and platform-specific\n behaviors (macOS option-as-alt).\n\n If you are using a terminal instance, you can set the key encoding\n options based on the active terminal state (e.g. legacy vs Kitty mode\n and associated flags) with ghostty_key_encoder_setopt_from_terminal().\n\n A null pointer value does nothing. It does not reset the value to the\n default. The setopt call will do nothing.\n\n @param encoder The encoder handle, must not be NULL\n @param option The option to set\n @param value Pointer to the value to set (type depends on the option)\n\n @ingroup key"]
    pub fn ghostty_key_encoder_setopt(
        encoder: GhosttyKeyEncoder_ptr,
        option: GhosttyKeyEncoderOption,
        value: *const ::std::os::raw::c_void,
    );
}
unsafe extern "C" {
    #[doc = " Set encoder options from a terminal's current state.\n\n Reads the terminal's current modes and flags and applies them to the\n encoder's options. This sets cursor key application mode, keypad mode,\n alt escape prefix, modifyOtherKeys state, and Kitty keyboard protocol\n flags from the terminal state.\n\n Note that the `macos_option_as_alt` option cannot be determined from\n terminal state and is reset to `GHOSTTY_OPTION_AS_ALT_FALSE` by this\n call. Use ghostty_key_encoder_setopt() to set it afterward if needed.\n\n @param encoder The encoder handle, must not be NULL\n @param terminal The terminal handle, must not be NULL\n\n @ingroup key"]
    pub fn ghostty_key_encoder_setopt_from_terminal(
        encoder: GhosttyKeyEncoder_ptr,
        terminal: GhosttyTerminal_ptr,
    );
}
unsafe extern "C" {
    #[doc = " Encode a key event into a terminal escape sequence.\n\n Converts a key event into the appropriate terminal escape sequence based on\n the encoder's current options. The sequence is written to the provided buffer.\n\n Not all key events produce output. For example, unmodified modifier keys\n typically don't generate escape sequences. Check the out_len parameter to\n determine if any data was written.\n\n If the output buffer is too small, this function returns GHOSTTY_OUT_OF_SPACE\n and out_len will contain the required buffer size. The caller can then\n allocate a larger buffer and call the function again.\n\n @param encoder The encoder handle, must not be NULL\n @param event The key event to encode, must not be NULL\n @param out_buf Buffer to write the encoded sequence to\n @param out_buf_size Size of the output buffer in bytes\n @param out_len Pointer to store the number of bytes written (may be NULL)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if buffer too small, or other error code\n\n ## Example: Calculate required buffer size\n\n @code{.c}\n // Query the required size with a NULL buffer (always returns OUT_OF_SPACE)\n size_t required = 0;\n GhosttyResult result = ghostty_key_encoder_encode(encoder, event, NULL, 0, &required);\n assert(result == GHOSTTY_OUT_OF_SPACE);\n\n // Allocate buffer of required size\n char *buf = malloc(required);\n\n // Encode with properly sized buffer\n size_t written = 0;\n result = ghostty_key_encoder_encode(encoder, event, buf, required, &written);\n assert(result == GHOSTTY_SUCCESS);\n\n // Use the encoded sequence...\n\n free(buf);\n @endcode\n\n ## Example: Direct encoding with static buffer\n\n @code{.c}\n // Most escape sequences are short, so a static buffer often suffices\n char buf[128];\n size_t written = 0;\n GhosttyResult result = ghostty_key_encoder_encode(encoder, event, buf, sizeof(buf), &written);\n\n if (result == GHOSTTY_SUCCESS) {\n   // Write the encoded sequence to the terminal\n   write(pty_fd, buf, written);\n } else if (result == GHOSTTY_OUT_OF_SPACE) {\n   // Buffer too small, written contains required size\n   char *dynamic_buf = malloc(written);\n   result = ghostty_key_encoder_encode(encoder, event, dynamic_buf, written, &written);\n   assert(result == GHOSTTY_SUCCESS);\n   write(pty_fd, dynamic_buf, written);\n   free(dynamic_buf);\n }\n @endcode\n\n @ingroup key"]
    pub fn ghostty_key_encoder_encode(
        encoder: GhosttyKeyEncoder_ptr,
        event: GhosttyKeyEvent_ptr,
        out_buf: *mut ::std::os::raw::c_char,
        out_buf_size: usize,
        out_len: *mut usize,
    ) -> GhosttyResult;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyMouseEvent {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a mouse event.\n\n This handle represents a normalized mouse input event containing\n action, button, modifiers, and surface-space position.\n\n @ingroup mouse"]
pub type GhosttyMouseEvent_ptr = *mut GhosttyMouseEvent;
#[doc = " Mouse button was pressed."]
pub const GhosttyMouseAction_GHOSTTY_MOUSE_ACTION_PRESS: GhosttyMouseAction = 0;
#[doc = " Mouse button was released."]
pub const GhosttyMouseAction_GHOSTTY_MOUSE_ACTION_RELEASE: GhosttyMouseAction = 1;
#[doc = " Mouse moved."]
pub const GhosttyMouseAction_GHOSTTY_MOUSE_ACTION_MOTION: GhosttyMouseAction = 2;
#[doc = " Mouse event action type.\n\n @ingroup mouse"]
pub type GhosttyMouseAction = ::std::os::raw::c_uint;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_UNKNOWN: GhosttyMouseButton = 0;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_LEFT: GhosttyMouseButton = 1;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_RIGHT: GhosttyMouseButton = 2;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_MIDDLE: GhosttyMouseButton = 3;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_FOUR: GhosttyMouseButton = 4;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_FIVE: GhosttyMouseButton = 5;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_SIX: GhosttyMouseButton = 6;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_SEVEN: GhosttyMouseButton = 7;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_EIGHT: GhosttyMouseButton = 8;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_NINE: GhosttyMouseButton = 9;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_TEN: GhosttyMouseButton = 10;
pub const GhosttyMouseButton_GHOSTTY_MOUSE_BUTTON_ELEVEN: GhosttyMouseButton = 11;
#[doc = " Mouse button identity.\n\n @ingroup mouse"]
pub type GhosttyMouseButton = ::std::os::raw::c_uint;
#[doc = " Mouse position in surface-space pixels.\n\n @ingroup mouse"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyMousePosition {
    pub x: f32,
    pub y: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyMousePosition"][::std::mem::size_of::<GhosttyMousePosition>() - 8usize];
    ["Alignment of GhosttyMousePosition"][::std::mem::align_of::<GhosttyMousePosition>() - 4usize];
    ["Offset of field: GhosttyMousePosition::x"]
        [::std::mem::offset_of!(GhosttyMousePosition, x) - 0usize];
    ["Offset of field: GhosttyMousePosition::y"]
        [::std::mem::offset_of!(GhosttyMousePosition, y) - 4usize];
};
unsafe extern "C" {
    #[doc = " Create a new mouse event instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param event Pointer to store the created event handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_new(
        allocator: *const GhosttyAllocator,
        event: *mut GhosttyMouseEvent_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a mouse event instance.\n\n @param event The mouse event handle to free (may be NULL)\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_free(event: GhosttyMouseEvent_ptr);
}
unsafe extern "C" {
    #[doc = " Set the event action.\n\n @param event The event handle, must not be NULL\n @param action The action to set\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_set_action(event: GhosttyMouseEvent_ptr, action: GhosttyMouseAction);
}
unsafe extern "C" {
    #[doc = " Get the event action.\n\n @param event The event handle, must not be NULL\n @return The event action\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_get_action(event: GhosttyMouseEvent_ptr) -> GhosttyMouseAction;
}
unsafe extern "C" {
    #[doc = " Set the event button.\n\n This sets a concrete button identity for the event.\n To represent \"no button\" (for motion events), use\n ghostty_mouse_event_clear_button().\n\n @param event The event handle, must not be NULL\n @param button The button to set\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_set_button(event: GhosttyMouseEvent_ptr, button: GhosttyMouseButton);
}
unsafe extern "C" {
    #[doc = " Clear the event button.\n\n This sets the event button to \"none\".\n\n @param event The event handle, must not be NULL\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_clear_button(event: GhosttyMouseEvent_ptr);
}
unsafe extern "C" {
    #[doc = " Get the event button.\n\n @param event The event handle, must not be NULL\n @param out_button Output pointer for the button value (may be NULL)\n @return true if a button is set, false if no button is set\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_get_button(
        event: GhosttyMouseEvent_ptr,
        out_button: *mut GhosttyMouseButton,
    ) -> bool;
}
unsafe extern "C" {
    #[doc = " Set keyboard modifiers held during the event.\n\n @param event The event handle, must not be NULL\n @param mods Modifier bitmask\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_set_mods(event: GhosttyMouseEvent_ptr, mods: GhosttyMods);
}
unsafe extern "C" {
    #[doc = " Get keyboard modifiers held during the event.\n\n @param event The event handle, must not be NULL\n @return Modifier bitmask\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_get_mods(event: GhosttyMouseEvent_ptr) -> GhosttyMods;
}
unsafe extern "C" {
    #[doc = " Set the event position in surface-space pixels.\n\n @param event The event handle, must not be NULL\n @param position The position to set\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_set_position(
        event: GhosttyMouseEvent_ptr,
        position: GhosttyMousePosition,
    );
}
unsafe extern "C" {
    #[doc = " Get the event position in surface-space pixels.\n\n @param event The event handle, must not be NULL\n @return The current event position\n\n @ingroup mouse"]
    pub fn ghostty_mouse_event_get_position(event: GhosttyMouseEvent_ptr) -> GhosttyMousePosition;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct GhosttyMouseEncoder {
    _unused: [u8; 0],
}
#[doc = " Opaque handle to a mouse encoder instance.\n\n This handle represents a mouse encoder that converts normalized\n mouse events into terminal escape sequences.\n\n @ingroup mouse"]
pub type GhosttyMouseEncoder_ptr = *mut GhosttyMouseEncoder;
#[doc = " Mouse reporting disabled."]
pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_NONE: GhosttyMouseTrackingMode = 0;
#[doc = " X10 mouse mode."]
pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_X10: GhosttyMouseTrackingMode = 1;
#[doc = " Normal mouse mode (button press/release only)."]
pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_NORMAL: GhosttyMouseTrackingMode = 2;
#[doc = " Button-event tracking mode."]
pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_BUTTON: GhosttyMouseTrackingMode = 3;
#[doc = " Any-event tracking mode."]
pub const GhosttyMouseTrackingMode_GHOSTTY_MOUSE_TRACKING_ANY: GhosttyMouseTrackingMode = 4;
#[doc = " Mouse tracking mode.\n\n @ingroup mouse"]
pub type GhosttyMouseTrackingMode = ::std::os::raw::c_uint;
pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_X10: GhosttyMouseFormat = 0;
pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_UTF8: GhosttyMouseFormat = 1;
pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_SGR: GhosttyMouseFormat = 2;
pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_URXVT: GhosttyMouseFormat = 3;
pub const GhosttyMouseFormat_GHOSTTY_MOUSE_FORMAT_SGR_PIXELS: GhosttyMouseFormat = 4;
#[doc = " Mouse output format.\n\n @ingroup mouse"]
pub type GhosttyMouseFormat = ::std::os::raw::c_uint;
#[doc = " Mouse encoder size and geometry context.\n\n This describes the rendered terminal geometry used to convert\n surface-space positions into encoded coordinates.\n\n @ingroup mouse"]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct GhosttyMouseEncoderSize {
    #[doc = " Size of this struct in bytes. Must be set to sizeof(GhosttyMouseEncoderSize)."]
    pub size: usize,
    #[doc = " Full screen width in pixels."]
    pub screen_width: u32,
    #[doc = " Full screen height in pixels."]
    pub screen_height: u32,
    #[doc = " Cell width in pixels. Must be non-zero."]
    pub cell_width: u32,
    #[doc = " Cell height in pixels. Must be non-zero."]
    pub cell_height: u32,
    #[doc = " Top padding in pixels."]
    pub padding_top: u32,
    #[doc = " Bottom padding in pixels."]
    pub padding_bottom: u32,
    #[doc = " Right padding in pixels."]
    pub padding_right: u32,
    #[doc = " Left padding in pixels."]
    pub padding_left: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of GhosttyMouseEncoderSize"][::std::mem::size_of::<GhosttyMouseEncoderSize>() - 40usize];
    ["Alignment of GhosttyMouseEncoderSize"]
        [::std::mem::align_of::<GhosttyMouseEncoderSize>() - 8usize];
    ["Offset of field: GhosttyMouseEncoderSize::size"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, size) - 0usize];
    ["Offset of field: GhosttyMouseEncoderSize::screen_width"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, screen_width) - 8usize];
    ["Offset of field: GhosttyMouseEncoderSize::screen_height"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, screen_height) - 12usize];
    ["Offset of field: GhosttyMouseEncoderSize::cell_width"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, cell_width) - 16usize];
    ["Offset of field: GhosttyMouseEncoderSize::cell_height"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, cell_height) - 20usize];
    ["Offset of field: GhosttyMouseEncoderSize::padding_top"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_top) - 24usize];
    ["Offset of field: GhosttyMouseEncoderSize::padding_bottom"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_bottom) - 28usize];
    ["Offset of field: GhosttyMouseEncoderSize::padding_right"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_right) - 32usize];
    ["Offset of field: GhosttyMouseEncoderSize::padding_left"]
        [::std::mem::offset_of!(GhosttyMouseEncoderSize, padding_left) - 36usize];
};
#[doc = " Mouse tracking mode (value: GhosttyMouseTrackingMode)."]
pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_EVENT: GhosttyMouseEncoderOption = 0;
#[doc = " Mouse output format (value: GhosttyMouseFormat)."]
pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_FORMAT: GhosttyMouseEncoderOption = 1;
#[doc = " Renderer size context (value: GhosttyMouseEncoderSize)."]
pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_SIZE: GhosttyMouseEncoderOption = 2;
#[doc = " Whether any mouse button is currently pressed (value: bool)."]
pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_ANY_BUTTON_PRESSED:
    GhosttyMouseEncoderOption = 3;
#[doc = " Whether to enable motion deduplication by last cell (value: bool)."]
pub const GhosttyMouseEncoderOption_GHOSTTY_MOUSE_ENCODER_OPT_TRACK_LAST_CELL:
    GhosttyMouseEncoderOption = 4;
#[doc = " Mouse encoder option identifiers.\n\n These values are used with ghostty_mouse_encoder_setopt() to configure\n the behavior of the mouse encoder.\n\n @ingroup mouse"]
pub type GhosttyMouseEncoderOption = ::std::os::raw::c_uint;
unsafe extern "C" {
    #[doc = " Create a new mouse encoder instance.\n\n @param allocator Pointer to allocator, or NULL to use the default allocator\n @param encoder Pointer to store the created encoder handle\n @return GHOSTTY_SUCCESS on success, or an error code on failure\n\n @ingroup mouse"]
    pub fn ghostty_mouse_encoder_new(
        allocator: *const GhosttyAllocator,
        encoder: *mut GhosttyMouseEncoder_ptr,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Free a mouse encoder instance.\n\n @param encoder The encoder handle to free (may be NULL)\n\n @ingroup mouse"]
    pub fn ghostty_mouse_encoder_free(encoder: GhosttyMouseEncoder_ptr);
}
unsafe extern "C" {
    #[doc = " Set an option on the mouse encoder.\n\n A null pointer value does nothing. It does not reset to defaults.\n\n @param encoder The encoder handle, must not be NULL\n @param option The option to set\n @param value Pointer to option value (type depends on option)\n\n @ingroup mouse"]
    pub fn ghostty_mouse_encoder_setopt(
        encoder: GhosttyMouseEncoder_ptr,
        option: GhosttyMouseEncoderOption,
        value: *const ::std::os::raw::c_void,
    );
}
unsafe extern "C" {
    #[doc = " Set encoder options from a terminal's current state.\n\n This sets tracking mode and output format from terminal state.\n It does not modify size or any-button state.\n\n @param encoder The encoder handle, must not be NULL\n @param terminal The terminal handle, must not be NULL\n\n @ingroup mouse"]
    pub fn ghostty_mouse_encoder_setopt_from_terminal(
        encoder: GhosttyMouseEncoder_ptr,
        terminal: GhosttyTerminal_ptr,
    );
}
unsafe extern "C" {
    #[doc = " Reset internal encoder state.\n\n This clears motion deduplication state (last tracked cell).\n\n @param encoder The encoder handle (may be NULL)\n\n @ingroup mouse"]
    pub fn ghostty_mouse_encoder_reset(encoder: GhosttyMouseEncoder_ptr);
}
unsafe extern "C" {
    #[doc = " Encode a mouse event into a terminal escape sequence.\n\n Not all mouse events produce output. In such cases this returns\n GHOSTTY_SUCCESS with out_len set to 0.\n\n If the output buffer is too small, this returns GHOSTTY_OUT_OF_SPACE\n and out_len contains the required size.\n\n @param encoder The encoder handle, must not be NULL\n @param event The mouse event to encode, must not be NULL\n @param out_buf Buffer to write encoded bytes to, or NULL to query required size\n @param out_buf_size Size of out_buf in bytes\n @param out_len Pointer to store bytes written (or required bytes on failure)\n @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_SPACE if buffer is too small,\n         or another error code\n\n @ingroup mouse"]
    pub fn ghostty_mouse_encoder_encode(
        encoder: GhosttyMouseEncoder_ptr,
        event: GhosttyMouseEvent_ptr,
        out_buf: *mut ::std::os::raw::c_char,
        out_buf_size: usize,
        out_len: *mut usize,
    ) -> GhosttyResult;
}
unsafe extern "C" {
    #[doc = " Check if paste data is safe to paste into the terminal.\n\n Data is considered unsafe if it contains:\n - Newlines (`\\n`) which can inject commands\n - The bracketed paste end sequence (`\\x1b[201~`) which can be used\n   to exit bracketed paste mode and inject commands\n\n This check is conservative and considers data unsafe regardless of\n current terminal state.\n\n @param data The paste data to check (must not be NULL)\n @param len The length of the data in bytes\n @return true if the data is safe to paste, false otherwise"]
    pub fn ghostty_paste_is_safe(data: *const ::std::os::raw::c_char, len: usize) -> bool;
}