Commit 5febdfcece40145f8394e6fe676db9436c6394df

Sam Lantinga 2018-09-24T11:49:25

Fixed whitespace

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
diff --git a/src/SDL.c b/src/SDL.c
index 5a1e0fe..6d7e166 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -124,11 +124,11 @@ SDL_InitSubSystem(Uint32 flags)
     }
 
 #if SDL_VIDEO_DRIVER_WINDOWS
-	if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
-		if (SDL_HelperWindowCreate() < 0) {
-			return -1;
-		}
-	}
+    if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
+        if (SDL_HelperWindowCreate() < 0) {
+            return -1;
+        }
+    }
 #endif
 
 #if !SDL_TIMERS_DISABLED
@@ -263,8 +263,8 @@ SDL_QuitSubSystem(Uint32 flags)
 #if !SDL_SENSOR_DISABLED
     if ((flags & SDL_INIT_SENSOR)) {
         if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
-			SDL_SensorQuit();
-		}
+            SDL_SensorQuit();
+        }
         SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR);
     }
 #endif
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index 48b9c0c..eff192b 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -445,7 +445,7 @@ static void
 ALSA_CloseDevice(_THIS)
 {
     if (this->hidden->pcm_handle) {
-	/* Wait for the submitted audio to drain
+        /* Wait for the submitted audio to drain
            ALSA_snd_pcm_drop() can hang, so don't use that.
          */
         Uint32 delay = ((this->spec.samples * 1000) / this->spec.freq) * 2;
diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c
index 4e3ebf2..47bad4b 100644
--- a/src/audio/arts/SDL_artsaudio.c
+++ b/src/audio/arts/SDL_artsaudio.c
@@ -39,7 +39,7 @@
 #include "SDL_name.h"
 #include "SDL_loadso.h"
 #else
-#define SDL_NAME(X)	X
+#define SDL_NAME(X) X
 #endif
 
 #ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c
index 09b83ae..a943ba2 100644
--- a/src/audio/directsound/SDL_directsound.c
+++ b/src/audio/directsound/SDL_directsound.c
@@ -477,8 +477,8 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
     SDL_bool tried_format = SDL_FALSE;
     SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
     LPGUID guid = (LPGUID) handle;
-	DWORD bufsize;
-	
+    DWORD bufsize;
+
     /* Initialize all variables that we clean on shutdown */
     this->hidden = (struct SDL_PrivateAudioData *)
         SDL_malloc((sizeof *this->hidden));
@@ -526,7 +526,7 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
                              (int) (DSBSIZE_MAX / numchunks));
             } else {
                 int rc;
-				WAVEFORMATEX wfmt;
+                WAVEFORMATEX wfmt;
                 SDL_zero(wfmt);
                 if (SDL_AUDIO_ISFLOAT(this->spec.format)) {
                     wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c
index 1e98580..053a1c3 100644
--- a/src/audio/pulseaudio/SDL_pulseaudio.c
+++ b/src/audio/pulseaudio/SDL_pulseaudio.c
@@ -109,7 +109,7 @@ static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *,
     pa_stream_success_cb_t, void *);
 static int (*PULSEAUDIO_pa_stream_peek) (pa_stream *, const void **, size_t *);
 static int (*PULSEAUDIO_pa_stream_drop) (pa_stream *);
-static pa_operation * (*PULSEAUDIO_pa_stream_flush)	(pa_stream *,
+static pa_operation * (*PULSEAUDIO_pa_stream_flush) (pa_stream *,
     pa_stream_success_cb_t, void *);
 static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *);
 static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *);
diff --git a/src/audio/winmm/SDL_winmm.c b/src/audio/winmm/SDL_winmm.c
index 8e5c17b..20426f1 100644
--- a/src/audio/winmm/SDL_winmm.c
+++ b/src/audio/winmm/SDL_winmm.c
@@ -78,7 +78,7 @@ static void DetectWave##typ##Devs(void) { \
     capstyp##2W caps; \
     UINT i; \
     for (i = 0; i < devcount; i++) { \
-	if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \
+        if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \
             char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid); \
             if (name != NULL) { \
                 SDL_AddAudioDevice((int) iscapture, name, (void *) ((size_t) i+1)); \
@@ -375,8 +375,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
 #endif
 
     /* Create the audio buffer semaphore */
-    this->hidden->audio_sem =
-		CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
+    this->hidden->audio_sem = CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
     if (this->hidden->audio_sem == NULL) {
         return SDL_SetError("Couldn't create semaphore");
     }
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c
index 9178604..15a1a74 100644
--- a/src/core/android/SDL_android.c
+++ b/src/core/android/SDL_android.c
@@ -77,7 +77,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
 JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
         JNIEnv* env, jclass jcls,
         jint surfaceWidth, jint surfaceHeight,
-		jint deviceWidth, jint deviceHeight, jint format, jfloat rate);
+        jint deviceWidth, jint deviceHeight, jint format, jfloat rate);
 
 JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(
         JNIEnv* env, jclass jcls);
@@ -537,7 +537,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
 JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
                                     JNIEnv* env, jclass jcls,
                                     jint surfaceWidth, jint surfaceHeight,
-									jint deviceWidth, jint deviceHeight, jint format, jfloat rate)
+                                    jint deviceWidth, jint deviceHeight, jint format, jfloat rate)
 {
     Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, format, rate);
 }
diff --git a/src/core/linux/SDL_dbus.h b/src/core/linux/SDL_dbus.h
index 062543d..aa787f2 100644
--- a/src/core/linux/SDL_dbus.h
+++ b/src/core/linux/SDL_dbus.h
@@ -39,9 +39,8 @@ typedef struct SDL_DBusContext {
     void (*bus_add_match)(DBusConnection *, const char *, DBusError *);
     DBusConnection * (*connection_open_private)(const char *, DBusError *);
     void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t);
-    dbus_bool_t (*connection_get_is_connected)(DBusConnection *); 	
-    dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction,
-	    void *, DBusFreeFunction);
+    dbus_bool_t (*connection_get_is_connected)(DBusConnection *);
+    dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction);
     dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *,
         const DBusObjectPathVTable *, void *, DBusError *);
     dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *);
@@ -51,7 +50,7 @@ typedef struct SDL_DBusContext {
     void (*connection_flush)(DBusConnection *);
     dbus_bool_t (*connection_read_write)(DBusConnection *, int);
     DBusDispatchStatus (*connection_dispatch)(DBusConnection *);
-    dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); 	
+    dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); 
     DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *);
     dbus_bool_t (*message_append_args)(DBusMessage *, int, ...);
     dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list);
@@ -61,7 +60,7 @@ typedef struct SDL_DBusContext {
     dbus_bool_t (*message_iter_next)(DBusMessageIter *);
     void (*message_iter_get_basic)(DBusMessageIter *, void *);
     int (*message_iter_get_arg_type)(DBusMessageIter *);
-    void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); 	 	
+    void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); 
     void (*message_unref)(DBusMessage *);
     void (*error_init)(DBusError *);
     dbus_bool_t (*error_is_set)(const DBusError *);
diff --git a/src/core/linux/SDL_udev.h b/src/core/linux/SDL_udev.h
index edf5187..033a299 100644
--- a/src/core/linux/SDL_udev.h
+++ b/src/core/linux/SDL_udev.h
@@ -77,9 +77,9 @@ typedef struct SDL_UDEV_PrivateData
     const char *(*udev_device_get_action)(struct udev_device *);
     const char *(*udev_device_get_devnode)(struct udev_device *);
     const char *(*udev_device_get_subsystem)(struct udev_device *);
-	struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype);
+    struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype);
     const char *(*udev_device_get_property_value)(struct udev_device *, const char *);
-	const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr);
+    const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr);
     struct udev_device *(*udev_device_new_from_syspath)(struct udev *, const char *);
     void (*udev_device_unref)(struct udev_device *);
     int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *);
diff --git a/src/core/winrt/SDL_winrtapp_xaml.cpp b/src/core/winrt/SDL_winrtapp_xaml.cpp
index 9789d03..7e2aac8 100644
--- a/src/core/winrt/SDL_winrtapp_xaml.cpp
+++ b/src/core/winrt/SDL_winrtapp_xaml.cpp
@@ -44,7 +44,7 @@ SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
 #if WINAPI_FAMILY == WINAPI_FAMILY_APP
 extern "C"
 ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
-static Windows::Foundation::EventRegistrationToken	WINRT_XAMLAppEventToken;
+static Windows::Foundation::EventRegistrationToken  WINRT_XAMLAppEventToken;
 #endif
 
 
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index baf85e5..15a44a8 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -1027,7 +1027,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const 
     }
 #ifdef __ANDROID__
     if (!mapping && name && !SDL_IsJoystickHIDAPI(guid)) {
-		mapping = SDL_CreateMappingForAndroidController(name, guid);
+        mapping = SDL_CreateMappingForAndroidController(name, guid);
     }
 #endif
     if (!mapping) {
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index d274444..5dece76 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -1141,13 +1141,13 @@ SDL_IsJoystickSteamController(Uint16 vendor, Uint16 product)
 SDL_bool
 SDL_IsJoystickXbox360(Uint16 vendor, Uint16 product)
 {
-	/* Filter out some bogus values here */
-	if (vendor == 0x0000 && product == 0x0000) {
-		return SDL_FALSE;
-	}
-	if (vendor == 0x0001 && product == 0x0001) {
-		return SDL_FALSE;
-	}
+    /* Filter out some bogus values here */
+    if (vendor == 0x0000 && product == 0x0000) {
+        return SDL_FALSE;
+    }
+    if (vendor == 0x0001 && product == 0x0001) {
+        return SDL_FALSE;
+    }
     return (GuessControllerType(vendor, product) == k_eControllerType_XBox360Controller);
 }
 
diff --git a/src/joystick/controller_type.h b/src/joystick/controller_type.h
index b5a5193..26054ed 100644
--- a/src/joystick/controller_type.h
+++ b/src/joystick/controller_type.h
@@ -43,9 +43,6 @@ typedef enum
 	k_eControllerType_SteamController = 2,
 	k_eControllerType_SteamControllerV2 = 3,
 
-	// IR Remote controls on Steambox
-	k_eControllerType_FrontPanelBoard = 20,
-
 	// Other Controllers
 	k_eControllerType_UnknownNonSteamController = 30,
 	k_eControllerType_XBox360Controller = 31,
@@ -73,49 +70,6 @@ static inline bool BIsSteamController( EControllerType eType )
 	return ( eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2 );
 }
 
-#if 0  /* these are currently unused, so #if 0'd out to prevent compiler warnings for now */
-static inline bool BIsSteamHardwareDevice( EControllerType eType )
-{
-	return ( eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2 || eType == k_eControllerType_FrontPanelBoard );
-}
-
-static inline bool BIsXInputController( EControllerType eType )
-{
-	return ( eType == k_eControllerType_XBox360Controller || eType == k_eControllerType_XBoxOneController || eType == k_eControllerType_UnknownNonSteamController );
-}
-
-static inline bool BIsSwitchController( EControllerType eType )
-{
-    return ( eType == k_eControllerType_SwitchJoyConLeft || eType == k_eControllerType_SwitchJoyConRight ||
-             eType == k_eControllerType_SwitchJoyConPair || eType == k_eControllerType_SwitchProController ||
-             eType == k_eControllerType_SwitchInputOnlyController );
-}
-
-/* XXX: this should be updated when we ship nintentdo switch controller support */
-static inline bool BIsRawHIDDevice( EControllerType eType )
-{
-	return BIsSteamHardwareDevice( eType) || eType == k_eControllerType_PS4Controller || BIsSwitchController( eType );
-}
-
-// 'Full' here means that the controller has a full complement of buttons, joysticks, etc, as compared to
-// the single Joy-Con's that only have around half of the controls that a normal controller has
-static inline bool BIsFullSwitchController( EControllerType eType )
-{
-    return ( eType == k_eControllerType_SwitchJoyConPair || eType == k_eControllerType_SwitchProController );
-}
-
-static inline bool BIsCompatibleType( EControllerType eTypeA, EControllerType eTypeB )
-{
-	if ( BIsSteamController( eTypeA ) && BIsSteamController( eTypeB ) )
-		return true;
-	if ( BIsXInputController( eTypeA ) && BIsXInputController( eTypeB ) )
-		return true;
-	if ( eTypeA == eTypeB )
-		return true;
-	return false;
-}
-#endif
-
 #define MAKE_CONTROLLER_ID( nVID, nPID )	(unsigned int)( nVID << 16 | nPID )
 typedef struct
 {
@@ -168,7 +122,6 @@ static const ControllerDescription_t arrControllers[] = {
 	{ MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_PS3Controller },		// From SDL
 	{ MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller },		// Firestorm Dual Analog 3
 	{ MAKE_CONTROLLER_ID( 0x0925, 0x8888 ), k_eControllerType_PS3Controller },		// Actually ps2 -maybe break out later Lakeview Research WiseGroup Ltd, MP-8866 Dual Joypad
-	{ MAKE_CONTROLLER_ID( 0x146b, 0x0602 ), k_eControllerType_PS3Controller },		// From SDL
 	{ MAKE_CONTROLLER_ID( 0x0f0d, 0x004d ), k_eControllerType_PS3Controller },		// Horipad 3
 	{ MAKE_CONTROLLER_ID( 0x0f0d, 0x0009 ), k_eControllerType_PS3Controller },		// HORI BDA GP1
 	{ MAKE_CONTROLLER_ID( 0x0e8f, 0x0008 ), k_eControllerType_PS3Controller },		// Green Asia
@@ -214,8 +167,8 @@ static const ControllerDescription_t arrControllers[] = {
 	{ MAKE_CONTROLLER_ID( 0x1532, 0x1000 ), k_eControllerType_PS4Controller },		// Razer Raiju PS4 Controller
 	{ MAKE_CONTROLLER_ID( 0x1532, 0X0401 ), k_eControllerType_PS4Controller },		// Razer Panthera PS4 Controller
 	{ MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller },		// STRIKEPAD PS4 Grip Add-on
-	{ MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller },		// Nacon Revolution Pro Controller
-	{ MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller },		// Nacon Revolution Pro Controller v2
+	{ MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller },		// Nacon Revolution Pro Controller - has gyro
+	{ MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller },		// Nacon Revolution Pro Controller v2 - has gyro
 	{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00a0 ), k_eControllerType_PS4Controller },		// HORI TAC4 mousething
 	{ MAKE_CONTROLLER_ID( 0x0f0d, 0x009c ), k_eControllerType_PS4Controller },		// HORI TAC PRO mousething
 	{ MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller },		// Hitbox Arcade Stick
@@ -224,7 +177,15 @@ static const ControllerDescription_t arrControllers[] = {
 	{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00ee ), k_eControllerType_PS4Controller },		// Hori mini wired https://www.playstation.com/en-us/explore/accessories/gaming-controllers/mini-wired-gamepad/
 	{ MAKE_CONTROLLER_ID( 0x0738, 0x8481 ), k_eControllerType_PS4Controller },		// Mad Catz FightStick TE 2+ PS4
 	{ MAKE_CONTROLLER_ID( 0x0738, 0x8480 ), k_eControllerType_PS4Controller },		// Mad Catz FightStick TE 2 PS4
-	{ MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller },		// Armor 3 or Level Up Cobra
+	{ MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller },		// Armor 3 or Level Up Cobra - At least one variant has gyro
+	{ MAKE_CONTROLLER_ID( 0x0c12, 0x0e15 ), k_eControllerType_PS4Controller },		// Game:Pad 4
+	{ MAKE_CONTROLLER_ID( 0x11c0, 0x4001 ), k_eControllerType_PS4Controller },		// "PS4 Fun Controller" added from user log
+
+	{ MAKE_CONTROLLER_ID( 0x1532, 0x1007 ), k_eControllerType_PS4Controller },		// Razer Raiju 2 Tournament edition USB- untested and added for razer
+	{ MAKE_CONTROLLER_ID( 0x1532, 0x100A ), k_eControllerType_PS4Controller },		// Razer Raiju 2 Tournament edition BT - untested and added for razer
+	{ MAKE_CONTROLLER_ID( 0x1532, 0x1004 ), k_eControllerType_PS4Controller },		// Razer Raiju 2 Ultimate USB - untested and added for razer
+	{ MAKE_CONTROLLER_ID( 0x1532, 0x1009 ), k_eControllerType_PS4Controller },		// Razer Raiju 2 Ultimate BT - untested and added for razer
+	{ MAKE_CONTROLLER_ID( 0x1532, 0x1008 ), k_eControllerType_PS4Controller },		// Razer Panthera Evo Fightstick - untested and added for razer
 
 	{ MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller },	// Elecom JC-U3613M
 	{ MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller },	// Saitek P3600
@@ -400,32 +361,42 @@ static const ControllerDescription_t arrControllers[] = {
 	{ MAKE_CONTROLLER_ID( 0x0079, 0x187c ), k_eControllerType_XBox360Controller },	// Unknown Controller
 	{ MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller },	// Unknown Controller
 	{ MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller },	// Unknown Controller
+
+	{ MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_XBox360Controller },	// SteelSeries Nimbus/Stratus XL
+
 																					
 	//{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/ },	// Unknown Controller
 
 	{ MAKE_CONTROLLER_ID( 0x05ac, 0x0001 ), k_eControllerType_AppleController },	// MFI Extended Gamepad (generic entry for iOS/tvOS)
 	{ MAKE_CONTROLLER_ID( 0x05ac, 0x0002 ), k_eControllerType_AppleController },	// MFI Standard Gamepad (generic entry for iOS/tvOS)
-	{ MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_AppleController },	// SteelSeries Nimbus
 
     // We currently don't support using a pair of Switch Joy-Con's as a single
     // controller and we don't want to support using them individually for the
     // time being, so these should be disabled until one of the above is true
     // { MAKE_CONTROLLER_ID( 0x057e, 0x2006 ), k_eControllerType_SwitchJoyConLeft },    // Nintendo Switch Joy-Con (Left)
     // { MAKE_CONTROLLER_ID( 0x057e, 0x2007 ), k_eControllerType_SwitchJoyConRight },   // Nintendo Switch Joy-Con (Right)
+
+    // This same controller ID is spoofed by many 3rd-party Switch controllers.
+    // The ones we currently know of are:
+    // * Any 8bitdo controller with Switch support
+    // * ORTZ Gaming Wireless Pro Controller
+    // * ZhiXu Gamepad Wireless
+    // * Sunwaytek Wireless Motion Controller for Nintendo Switch
 	{ MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController },        // Nintendo Switch Pro Controller
+    
     { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController },  // HORIPAD for Nintendo Switch
     { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController },  // PowerA Wired Controller Plus
+    { MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController },  // HORI Pokken Tournament DX Pro Pad
 
 
 	// Valve products - don't add to public list
-    { MAKE_CONTROLLER_ID( 0x0000, 0x11fa ), k_eControllerType_MobileTouch },		// Streaming mobile touch virtual controls
+    { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch },		// Streaming mobile touch virtual controls
 	{ MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController },	// Valve Legacy Steam Controller (CHELL)
 	{ MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController },	// Valve wired Steam Controller (D0G)
 	{ MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamControllerV2 },	// Valve Bluetooth Steam Controller (D0G)
 	{ MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamControllerV2 },	// Valve Bluetooth Steam Controller (D0G)
 	{ MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController },	// Valve wireless Steam Controller
 	{ MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamController },	// Valve wired Steam Controller (HEADCRAB)
-	{ MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2 },	// Valve Bluetooth Steam Controller (HEADCRAB)
 };
 
 
diff --git a/src/joystick/haiku/SDL_haikujoystick.cc b/src/joystick/haiku/SDL_haikujoystick.cc
index 30f919c..b3b0467 100644
--- a/src/joystick/haiku/SDL_haikujoystick.cc
+++ b/src/joystick/haiku/SDL_haikujoystick.cc
@@ -36,7 +36,7 @@ extern "C"
 
 
 /* The maximum number of joysticks we'll detect */
-#define MAX_JOYSTICKS	16
+#define MAX_JOYSTICKS   16
 
 /* A list of available joysticks */
     static char *SDL_joyport[MAX_JOYSTICKS];
diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c
index 4ae17cc..ebd15a8 100644
--- a/src/joystick/windows/SDL_windowsjoystick.c
+++ b/src/joystick/windows/SDL_windowsjoystick.c
@@ -255,7 +255,7 @@ SDL_JoystickThread(void *_data)
             /* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */
             break;
 #endif /* SDL_JOYSTICK_XINPUT */
-		}
+        }
 
         if (s_bWindowsDeviceChanged || bXInputChanged) {
             s_bDeviceRemoved = SDL_TRUE;
diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h
index 3c41675..7adbd00 100644
--- a/src/main/haiku/SDL_BApp.h
+++ b/src/main/haiku/SDL_BApp.h
@@ -198,7 +198,7 @@ public:
             _current_context->UnlockGL();
         _current_context = newContext;
         if (_current_context)
-	        _current_context->LockGL();
+            _current_context->LockGL();
     }
 #endif
 
diff --git a/src/main/haiku/SDL_BeApp.cc b/src/main/haiku/SDL_BeApp.cc
index f4ee179..cbd2129 100644
--- a/src/main/haiku/SDL_BeApp.cc
+++ b/src/main/haiku/SDL_BeApp.cc
@@ -31,7 +31,7 @@
 #include <storage/File.h>
 #include <unistd.h>
 
-#include "SDL_BApp.h"	/* SDL_BApp class definition */
+#include "SDL_BApp.h"   /* SDL_BApp class definition */
 #include "SDL_BeApp.h"
 #include "SDL_timer.h"
 #include "SDL_error.h"
@@ -53,24 +53,24 @@ StartBeApp(void *unused)
 {
     BApplication *App;
 
-	// default application signature
-	const char *signature = "application/x-SDL-executable";
-	// dig resources for correct signature
-	image_info info;
-	int32 cookie = 0;
-	if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
-		BFile f(info.name, O_RDONLY);
-		if (f.InitCheck() == B_OK) {
-			BAppFileInfo app_info(&f);
-			if (app_info.InitCheck() == B_OK) {
-				char sig[B_MIME_TYPE_LENGTH];
-				if (app_info.GetSignature(sig) == B_OK)
-					signature = strndup(sig, B_MIME_TYPE_LENGTH);
-			}
-		}
-	}
-
-	App = new SDL_BApp(signature);
+    // default application signature
+    const char *signature = "application/x-SDL-executable";
+    // dig resources for correct signature
+    image_info info;
+    int32 cookie = 0;
+    if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
+        BFile f(info.name, O_RDONLY);
+        if (f.InitCheck() == B_OK) {
+            BAppFileInfo app_info(&f);
+            if (app_info.InitCheck() == B_OK) {
+                char sig[B_MIME_TYPE_LENGTH];
+                if (app_info.GetSignature(sig) == B_OK)
+                    signature = strndup(sig, B_MIME_TYPE_LENGTH);
+            }
+        }
+    }
+
+    App = new SDL_BApp(signature);
 
     App->Run();
     delete App;
@@ -144,12 +144,12 @@ SDL_QuitBeApp(void)
 
 /* SDL_BApp functions */
 void SDL_BApp::ClearID(SDL_BWin *bwin) {
-	_SetSDLWindow(NULL, bwin->GetID());
-	int32 i = _GetNumWindowSlots() - 1;
-	while(i >= 0 && GetSDLWindow(i) == NULL) {
-		_PopBackWindow();
-		--i;
-	}
+    _SetSDLWindow(NULL, bwin->GetID());
+    int32 i = _GetNumWindowSlots() - 1;
+    while(i >= 0 && GetSDLWindow(i) == NULL) {
+        _PopBackWindow();
+        --i;
+    }
 }
 
 #endif /* __HAIKU__ */
diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c
index f8dbc9f..e2e3a3f 100644
--- a/src/stdlib/SDL_iconv.c
+++ b/src/stdlib/SDL_iconv.c
@@ -89,13 +89,13 @@ SDL_iconv(SDL_iconv_t cd,
 #else
 
 /* Lots of useful information on Unicode at:
-	http://www.cl.cam.ac.uk/~mgk25/unicode.html
+    http://www.cl.cam.ac.uk/~mgk25/unicode.html
 */
 
-#define UNICODE_BOM	0xFEFF
+#define UNICODE_BOM    0xFEFF
 
-#define UNKNOWN_ASCII	'?'
-#define UNKNOWN_UNICODE	0xFFFD
+#define UNKNOWN_ASCII    '?'
+#define UNKNOWN_UNICODE    0xFFFD
 
 enum
 {
@@ -115,13 +115,13 @@ enum
     ENCODING_UCS4LE,
 };
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#define ENCODING_UTF16NATIVE	ENCODING_UTF16BE
-#define ENCODING_UTF32NATIVE	ENCODING_UTF32BE
+#define ENCODING_UTF16NATIVE    ENCODING_UTF16BE
+#define ENCODING_UTF32NATIVE    ENCODING_UTF32BE
 #define ENCODING_UCS2NATIVE     ENCODING_UCS2BE
 #define ENCODING_UCS4NATIVE     ENCODING_UCS4BE
 #else
-#define ENCODING_UTF16NATIVE	ENCODING_UTF16LE
-#define ENCODING_UTF32NATIVE	ENCODING_UTF32LE
+#define ENCODING_UTF16NATIVE    ENCODING_UTF16LE
+#define ENCODING_UTF32NATIVE    ENCODING_UTF32LE
 #define ENCODING_UCS2NATIVE     ENCODING_UCS2LE
 #define ENCODING_UCS4NATIVE     ENCODING_UCS4LE
 #endif
diff --git a/src/video/SDL_blit_1.c b/src/video/SDL_blit_1.c
index b7c5412..56ccf15 100644
--- a/src/video/SDL_blit_1.c
+++ b/src/video/SDL_blit_1.c
@@ -49,13 +49,13 @@ Blit1to1(SDL_BlitInfo * info)
     while (height--) {
 #ifdef USE_DUFFS_LOOP
         /* *INDENT-OFF* */
-		DUFFS_LOOP(
-			{
-			  *dst = map[*src];
-			}
-			dst++;
-			src++;
-		, width);
+        DUFFS_LOOP(
+            {
+              *dst = map[*src];
+            }
+            dst++;
+            src++;
+        , width);
         /* *INDENT-ON* */
 #else
         for (c = width; c; --c) {
@@ -72,11 +72,11 @@ Blit1to1(SDL_BlitInfo * info)
 /* This is now endian dependent */
 #ifndef USE_DUFFS_LOOP
 # if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
-#  define HI	1
-#  define LO	0
+#  define HI    1
+#  define LO    0
 # else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
-#  define HI	0
-#  define LO	1
+#  define HI    0
+#  define LO    1
 # endif
 #endif
 static void
@@ -101,14 +101,14 @@ Blit1to2(SDL_BlitInfo * info)
 
 #ifdef USE_DUFFS_LOOP
     while (height--) {
-		/* *INDENT-OFF* */
-		DUFFS_LOOP(
-		{
-			*(Uint16 *)dst = map[*src++];
-			dst += 2;
-		},
-		width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+        {
+            *(Uint16 *)dst = map[*src++];
+            dst += 2;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
@@ -208,18 +208,18 @@ Blit1to3(SDL_BlitInfo * info)
 
     while (height--) {
 #ifdef USE_DUFFS_LOOP
-		/* *INDENT-OFF* */
-		DUFFS_LOOP(
-			{
-				o = *src * 4;
-				dst[0] = map[o++];
-				dst[1] = map[o++];
-				dst[2] = map[o++];
-			}
-			src++;
-			dst += 3;
-		, width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+            {
+                o = *src * 4;
+                dst[0] = map[o++];
+                dst[1] = map[o++];
+                dst[2] = map[o++];
+            }
+            src++;
+            dst += 3;
+        , width);
+        /* *INDENT-ON* */
 #else
         for (c = width; c; --c) {
             o = *src * 4;
@@ -257,11 +257,11 @@ Blit1to4(SDL_BlitInfo * info)
 
     while (height--) {
 #ifdef USE_DUFFS_LOOP
-		/* *INDENT-OFF* */
-		DUFFS_LOOP(
-			*dst++ = map[*src++];
-		, width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+            *dst++ = map[*src++];
+        , width);
+        /* *INDENT-ON* */
 #else
         for (c = width / 4; c; --c) {
             *dst++ = map[*src++];
@@ -297,33 +297,33 @@ Blit1to1Key(SDL_BlitInfo * info)
 
     if (palmap) {
         while (height--) {
-			/* *INDENT-OFF* */
-			DUFFS_LOOP(
-			{
-				if ( *src != ckey ) {
-				  *dst = palmap[*src];
-				}
-				dst++;
-				src++;
-			},
-			width);
-			/* *INDENT-ON* */
+            /* *INDENT-OFF* */
+            DUFFS_LOOP(
+            {
+                if ( *src != ckey ) {
+                  *dst = palmap[*src];
+                }
+                dst++;
+                src++;
+            },
+            width);
+            /* *INDENT-ON* */
             src += srcskip;
             dst += dstskip;
         }
     } else {
         while (height--) {
-			/* *INDENT-OFF* */
-			DUFFS_LOOP(
-			{
-				if ( *src != ckey ) {
-				  *dst = *src;
-				}
-				dst++;
-				src++;
-			},
-			width);
-			/* *INDENT-ON* */
+            /* *INDENT-OFF* */
+            DUFFS_LOOP(
+            {
+                if ( *src != ckey ) {
+                  *dst = *src;
+                }
+                dst++;
+                src++;
+            },
+            width);
+            /* *INDENT-ON* */
             src += srcskip;
             dst += dstskip;
         }
@@ -346,17 +346,17 @@ Blit1to2Key(SDL_BlitInfo * info)
     dstskip /= 2;
 
     while (height--) {
-		/* *INDENT-OFF* */
-		DUFFS_LOOP(
-		{
-			if ( *src != ckey ) {
-				*dstp=palmap[*src];
-			}
-			src++;
-			dstp++;
-		},
-		width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+        {
+            if ( *src != ckey ) {
+                *dstp=palmap[*src];
+            }
+            src++;
+            dstp++;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dstp += dstskip;
     }
@@ -376,20 +376,20 @@ Blit1to3Key(SDL_BlitInfo * info)
     int o;
 
     while (height--) {
-		/* *INDENT-OFF* */
-		DUFFS_LOOP(
-		{
-			if ( *src != ckey ) {
-				o = *src * 4;
-				dst[0] = palmap[o++];
-				dst[1] = palmap[o++];
-				dst[2] = palmap[o++];
-			}
-			src++;
-			dst += 3;
-		},
-		width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+        {
+            if ( *src != ckey ) {
+                o = *src * 4;
+                dst[0] = palmap[o++];
+                dst[1] = palmap[o++];
+                dst[2] = palmap[o++];
+            }
+            src++;
+            dst += 3;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
@@ -411,17 +411,17 @@ Blit1to4Key(SDL_BlitInfo * info)
     dstskip /= 4;
 
     while (height--) {
-		/* *INDENT-OFF* */
-		DUFFS_LOOP(
-		{
-			if ( *src != ckey ) {
-				*dstp = palmap[*src];
-			}
-			src++;
-			dstp++;
-		},
-		width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+        {
+            if ( *src != ckey ) {
+                *dstp = palmap[*src];
+            }
+            src++;
+            dstp++;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dstp += dstskip;
     }
@@ -489,22 +489,22 @@ Blit1toNAlphaKey(SDL_BlitInfo * info)
     dstbpp = dstfmt->BytesPerPixel;
 
     while (height--) {
-		/* *INDENT-OFF* */
-		DUFFS_LOOP(
-		{
-			if ( *src != ckey ) {
-				sR = srcpal[*src].r;
-				sG = srcpal[*src].g;
-				sB = srcpal[*src].b;
-				DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
-				ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
-			  	ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
-			}
-			src++;
-			dst += dstbpp;
-		},
-		width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+        {
+            if ( *src != ckey ) {
+                sR = srcpal[*src].r;
+                sG = srcpal[*src].g;
+                sB = srcpal[*src].b;
+                DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
+                ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
+                  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+            }
+            src++;
+            dst += dstbpp;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c
index 1e9c9d8..3507932 100644
--- a/src/video/SDL_blit_A.c
+++ b/src/video/SDL_blit_A.c
@@ -45,28 +45,28 @@ BlitNto1SurfaceAlpha(SDL_BlitInfo * info)
     const unsigned A = info->a;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4(
-	    {
-		DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
-		dR = dstfmt->palette->colors[*dst].r;
-		dG = dstfmt->palette->colors[*dst].g;
-		dB = dstfmt->palette->colors[*dst].b;
-		ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB);
-		dR &= 0xff;
-		dG &= 0xff;
-		dB &= 0xff;
-		/* Pack RGB into 8bit pixel */
-		if ( palmap == NULL ) {
-		    *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
-		} else {
-		    *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
-		}
-		dst++;
-		src += srcbpp;
-	    },
-	    width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4(
+        {
+        DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+        dR = dstfmt->palette->colors[*dst].r;
+        dG = dstfmt->palette->colors[*dst].g;
+        dB = dstfmt->palette->colors[*dst].b;
+        ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB);
+        dR &= 0xff;
+        dG &= 0xff;
+        dB &= 0xff;
+        /* Pack RGB into 8bit pixel */
+        if ( palmap == NULL ) {
+            *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
+        } else {
+            *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
+        }
+        dst++;
+        src += srcbpp;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
@@ -91,28 +91,28 @@ BlitNto1PixelAlpha(SDL_BlitInfo * info)
     unsigned dR, dG, dB;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4(
-	    {
-		DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA);
-		dR = dstfmt->palette->colors[*dst].r;
-		dG = dstfmt->palette->colors[*dst].g;
-		dB = dstfmt->palette->colors[*dst].b;
-		ALPHA_BLEND_RGB(sR, sG, sB, sA, dR, dG, dB);
-		dR &= 0xff;
-		dG &= 0xff;
-		dB &= 0xff;
-		/* Pack RGB into 8bit pixel */
-		if ( palmap == NULL ) {
-		    *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
-		} else {
-		    *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
-		}
-		dst++;
-		src += srcbpp;
-	    },
-	    width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4(
+        {
+        DISEMBLE_RGBA(src,srcbpp,srcfmt,Pixel,sR,sG,sB,sA);
+        dR = dstfmt->palette->colors[*dst].r;
+        dG = dstfmt->palette->colors[*dst].g;
+        dB = dstfmt->palette->colors[*dst].b;
+        ALPHA_BLEND_RGB(sR, sG, sB, sA, dR, dG, dB);
+        dR &= 0xff;
+        dG &= 0xff;
+        dB &= 0xff;
+        /* Pack RGB into 8bit pixel */
+        if ( palmap == NULL ) {
+            *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
+        } else {
+            *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
+        }
+        dst++;
+        src += srcbpp;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
@@ -139,30 +139,30 @@ BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info)
     const unsigned A = info->a;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP(
-	    {
-		DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
-		if ( Pixel != ckey ) {
-		    dR = dstfmt->palette->colors[*dst].r;
-		    dG = dstfmt->palette->colors[*dst].g;
-		    dB = dstfmt->palette->colors[*dst].b;
-		    ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB);
-		    dR &= 0xff;
-		    dG &= 0xff;
-		    dB &= 0xff;
-		    /* Pack RGB into 8bit pixel */
-		    if ( palmap == NULL ) {
+        /* *INDENT-OFF* */
+        DUFFS_LOOP(
+        {
+        DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+        if ( Pixel != ckey ) {
+            dR = dstfmt->palette->colors[*dst].r;
+            dG = dstfmt->palette->colors[*dst].g;
+            dB = dstfmt->palette->colors[*dst].b;
+            ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB);
+            dR &= 0xff;
+            dG &= 0xff;
+            dB &= 0xff;
+            /* Pack RGB into 8bit pixel */
+            if ( palmap == NULL ) {
                 *dst =((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0));
-		    } else {
+            } else {
                 *dst = palmap[((dR>>5)<<(3+2))|((dG>>5)<<(2))|((dB>>6)<<(0))];
-		    }
-		}
-		dst++;
-		src += srcbpp;
-	    },
-	    width);
-	    /* *INDENT-ON* */
+            }
+        }
+        dst++;
+        src += srcbpp;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
@@ -342,45 +342,45 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
 
     mm_zero = _mm_setzero_si64();       /* 0 -> mm_zero */
     multmask = 0x00FF;
-	multmask <<= (ashift * 2);
-	multmask2 = 0x00FF00FF00FF00FFULL;
+    multmask <<= (ashift * 2);
+    multmask2 = 0x00FF00FF00FF00FFULL;
 
     while (height--) {
-		/* *INDENT-OFF* */
-		DUFFS_LOOP4({
-		Uint32 alpha = *srcp & amask;
-		if (alpha == 0) {
-			/* do nothing */
-		} else if (alpha == amask) {
-			*dstp = *srcp;
-		} else {
-			src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */
-			src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
-
-			dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
-			dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
-
-			mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
-			mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
-			mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
-			mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */
-			mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask);	/* 0F0A0A0A -> mm_alpha */
-			mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2);	/* 255 - mm_alpha -> mm_alpha */
-
-			/* blend */		    
-			src1 = _mm_mullo_pi16(src1, mm_alpha);
-			src1 = _mm_srli_pi16(src1, 8);
-			dst1 = _mm_mullo_pi16(dst1, mm_alpha2);
-			dst1 = _mm_srli_pi16(dst1, 8);
-			dst1 = _mm_add_pi16(src1, dst1);
-			dst1 = _mm_packs_pu16(dst1, mm_zero);
-			
-			*dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
-		}
-		++srcp;
-		++dstp;
-	    }, width);
-		/* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4({
+        Uint32 alpha = *srcp & amask;
+        if (alpha == 0) {
+            /* do nothing */
+        } else if (alpha == amask) {
+            *dstp = *srcp;
+        } else {
+            src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */
+            src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
+
+            dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
+            dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
+
+            mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
+            mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
+            mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
+            mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */
+            mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask);    /* 0F0A0A0A -> mm_alpha */
+            mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2);    /* 255 - mm_alpha -> mm_alpha */
+
+            /* blend */            
+            src1 = _mm_mullo_pi16(src1, mm_alpha);
+            src1 = _mm_srli_pi16(src1, 8);
+            dst1 = _mm_mullo_pi16(dst1, mm_alpha2);
+            dst1 = _mm_srli_pi16(dst1, 8);
+            dst1 = _mm_add_pi16(src1, dst1);
+            dst1 = _mm_packs_pu16(dst1, mm_zero);
+            
+            *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
+        }
+        ++srcp;
+        ++dstp;
+        }, width);
+        /* *INDENT-ON* */
         srcp += srcskip;
         dstp += dstskip;
     }
@@ -401,14 +401,14 @@ BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info)
     int dstskip = info->dst_skip >> 2;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4({
-		    Uint32 s = *srcp++;
-		    Uint32 d = *dstp;
-		    *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1)
-			       + (s & d & 0x00010101)) | 0xff000000;
-	    }, width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4({
+            Uint32 s = *srcp++;
+            Uint32 d = *dstp;
+            *dstp++ = ((((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1)
+                   + (s & d & 0x00010101)) | 0xff000000;
+        }, width);
+        /* *INDENT-ON* */
         srcp += srcskip;
         dstp += dstskip;
     }
@@ -434,22 +434,22 @@ BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
         Uint32 d1;
 
         while (height--) {
-			/* *INDENT-OFF* */
-			DUFFS_LOOP4({
-				s = *srcp;
-				d = *dstp;
-				s1 = s & 0xff00ff;
-				d1 = d & 0xff00ff;
-				d1 = (d1 + ((s1 - d1) * alpha >> 8))
-				     & 0xff00ff;
-				s &= 0xff00;
-				d &= 0xff00;
-				d = (d + ((s - d) * alpha >> 8)) & 0xff00;
-				*dstp = d1 | d | 0xff000000;
-				++srcp;
-				++dstp;
-			}, width);
-			/* *INDENT-ON* */
+            /* *INDENT-OFF* */
+            DUFFS_LOOP4({
+                s = *srcp;
+                d = *dstp;
+                s1 = s & 0xff00ff;
+                d1 = d & 0xff00ff;
+                d1 = (d1 + ((s1 - d1) * alpha >> 8))
+                     & 0xff00ff;
+                s &= 0xff00;
+                d &= 0xff00;
+                d = (d + ((s - d) * alpha >> 8)) & 0xff00;
+                *dstp = d1 | d | 0xff000000;
+                ++srcp;
+                ++dstp;
+            }, width);
+            /* *INDENT-ON* */
             srcp += srcskip;
             dstp += dstskip;
         }
@@ -468,42 +468,42 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info)
     int dstskip = info->dst_skip >> 2;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4({
-		Uint32 dalpha;
-		Uint32 d;
-		Uint32 s1;
-		Uint32 d1;
-		Uint32 s = *srcp;
-		Uint32 alpha = s >> 24;
-		/* FIXME: Here we special-case opaque alpha since the
-		   compositioning used (>>8 instead of /255) doesn't handle
-		   it correctly. Also special-case alpha=0 for speed?
-		   Benchmark this! */
-		if (alpha) {
-		  if (alpha == SDL_ALPHA_OPAQUE) {
-			  *dstp = *srcp;
-		  } else {
-		    /*
-		     * take out the middle component (green), and process
-		     * the other two in parallel. One multiply less.
-		     */
-		    d = *dstp;
-			dalpha = d >> 24;
-		    s1 = s & 0xff00ff;
-		    d1 = d & 0xff00ff;
-		    d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff;
-		    s &= 0xff00;
-		    d &= 0xff00;
-		    d = (d + ((s - d) * alpha >> 8)) & 0xff00;
-			dalpha = alpha + (dalpha * (alpha ^ 0xFF) >> 8);
-		    *dstp = d1 | d | (dalpha << 24);
-		  }
-		}
-		++srcp;
-		++dstp;
-	    }, width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4({
+        Uint32 dalpha;
+        Uint32 d;
+        Uint32 s1;
+        Uint32 d1;
+        Uint32 s = *srcp;
+        Uint32 alpha = s >> 24;
+        /* FIXME: Here we special-case opaque alpha since the
+           compositioning used (>>8 instead of /255) doesn't handle
+           it correctly. Also special-case alpha=0 for speed?
+           Benchmark this! */
+        if (alpha) {
+          if (alpha == SDL_ALPHA_OPAQUE) {
+              *dstp = *srcp;
+          } else {
+            /*
+             * take out the middle component (green), and process
+             * the other two in parallel. One multiply less.
+             */
+            d = *dstp;
+            dalpha = d >> 24;
+            s1 = s & 0xff00ff;
+            d1 = d & 0xff00ff;
+            d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff;
+            s &= 0xff00;
+            d &= 0xff00;
+            d = (d + ((s - d) * alpha >> 8)) & 0xff00;
+            dalpha = alpha + (dalpha * (alpha ^ 0xFF) >> 8);
+            *dstp = d1 | d | (dalpha << 24);
+          }
+        }
+        ++srcp;
+        ++dstp;
+        }, width);
+        /* *INDENT-ON* */
         srcp += srcskip;
         dstp += dstskip;
     }
@@ -533,47 +533,47 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
     multmask2 = 0x00FF00FF00FF00FFULL;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4({
-		Uint32 alpha;
-
-		_m_prefetch(srcp + 16);
-		_m_prefetch(dstp + 16);
-
-		alpha = *srcp & amask;
-		if (alpha == 0) {
-			/* do nothing */
-		} else if (alpha == amask) {
-			*dstp = *srcp;
-		} else {
-			src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */
-			src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
-
-			dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
-			dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
-
-			mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
-			mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
-			mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
-			mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */
-			mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask);	/* 0F0A0A0A -> mm_alpha */
-			mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2);	/* 255 - mm_alpha -> mm_alpha */
-
-
-			/* blend */		    
-			src1 = _mm_mullo_pi16(src1, mm_alpha);
-			src1 = _mm_srli_pi16(src1, 8);
-			dst1 = _mm_mullo_pi16(dst1, mm_alpha2);
-			dst1 = _mm_srli_pi16(dst1, 8);
-			dst1 = _mm_add_pi16(src1, dst1);
-			dst1 = _mm_packs_pu16(dst1, mm_zero);
-			
-			*dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
-		}
-		++srcp;
-		++dstp;
-	    }, width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4({
+        Uint32 alpha;
+
+        _m_prefetch(srcp + 16);
+        _m_prefetch(dstp + 16);
+
+        alpha = *srcp & amask;
+        if (alpha == 0) {
+            /* do nothing */
+        } else if (alpha == amask) {
+            *dstp = *srcp;
+        } else {
+            src1 = _mm_cvtsi32_si64(*srcp); /* src(ARGB) -> src1 (0000ARGB) */
+            src1 = _mm_unpacklo_pi8(src1, mm_zero); /* 0A0R0G0B -> src1 */
+
+            dst1 = _mm_cvtsi32_si64(*dstp); /* dst(ARGB) -> dst1 (0000ARGB) */
+            dst1 = _mm_unpacklo_pi8(dst1, mm_zero); /* 0A0R0G0B -> dst1 */
+
+            mm_alpha = _mm_cvtsi32_si64(alpha); /* alpha -> mm_alpha (0000000A) */
+            mm_alpha = _mm_srli_si64(mm_alpha, ashift); /* mm_alpha >> ashift -> mm_alpha(0000000A) */
+            mm_alpha = _mm_unpacklo_pi16(mm_alpha, mm_alpha); /* 00000A0A -> mm_alpha */
+            mm_alpha2 = _mm_unpacklo_pi32(mm_alpha, mm_alpha); /* 0A0A0A0A -> mm_alpha2 */
+            mm_alpha = _mm_or_si64(mm_alpha2, *(__m64 *) & multmask);    /* 0F0A0A0A -> mm_alpha */
+            mm_alpha2 = _mm_xor_si64(mm_alpha2, *(__m64 *) & multmask2);    /* 255 - mm_alpha -> mm_alpha */
+
+
+            /* blend */            
+            src1 = _mm_mullo_pi16(src1, mm_alpha);
+            src1 = _mm_srli_pi16(src1, 8);
+            dst1 = _mm_mullo_pi16(dst1, mm_alpha2);
+            dst1 = _mm_srli_pi16(dst1, 8);
+            dst1 = _mm_add_pi16(src1, dst1);
+            dst1 = _mm_packs_pu16(dst1, mm_zero);
+            
+            *dstp = _mm_cvtsi64_si32(dst1); /* dst1 -> pixel */
+        }
+        ++srcp;
+        ++dstp;
+        }, width);
+        /* *INDENT-ON* */
         srcp += srcskip;
         dstp += dstskip;
     }
@@ -585,13 +585,13 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
 /* 16bpp special case for per-surface alpha=50%: blend 2 pixels in parallel */
 
 /* blend a single 16 bit pixel at 50% */
-#define BLEND16_50(d, s, mask)						\
-	((((s & mask) + (d & mask)) >> 1) + (s & d & (~mask & 0xffff)))
+#define BLEND16_50(d, s, mask)                        \
+    ((((s & mask) + (d & mask)) >> 1) + (s & d & (~mask & 0xffff)))
 
 /* blend two 16 bit pixels at 50% */
-#define BLEND2x16_50(d, s, mask)					     \
-	(((s & (mask | mask << 16)) >> 1) + ((d & (mask | mask << 16)) >> 1) \
-	 + (s & d & (~(mask | mask << 16))))
+#define BLEND2x16_50(d, s, mask)                         \
+    (((s & (mask | mask << 16)) >> 1) + ((d & (mask | mask << 16)) >> 1) \
+     + (s & d & (~(mask | mask << 16))))
 
 static void
 Blit16to16SurfaceAlpha128(SDL_BlitInfo * info, Uint16 mask)
@@ -727,103 +727,103 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
         bmask = _mm_set_pi32(0x001F001F, 0x001F001F);   /* MASKBLUE -> bmask */
 
         while (height--) {
-			/* *INDENT-OFF* */
-			DUFFS_LOOP_124(
-			{
-				s = *srcp++;
-				d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x07e0f81f;
-				d = (d | d << 16) & 0x07e0f81f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x07e0f81f;
-				*dstp++ = (Uint16)(d | d >> 16);
-			},{
-				s = *srcp++;
-				d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x07e0f81f;
-				d = (d | d << 16) & 0x07e0f81f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x07e0f81f;
-				*dstp++ = (Uint16)(d | d >> 16);
-				s = *srcp++;
-				d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x07e0f81f;
-				d = (d | d << 16) & 0x07e0f81f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x07e0f81f;
-				*dstp++ = (Uint16)(d | d >> 16);
-			},{
-				src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */
-				dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */
-
-				/* red */
-				src2 = src1;
-				src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 [000r 000r 000r 000r] */
-
-				dst2 = dst1;
-				dst2 = _mm_srli_pi16(dst2, 11); /* dst2 >> 11 -> dst2 [000r 000r 000r 000r] */
-
-				/* blend */
-				src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
-				src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
-				src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
-				dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
-				dst2 = _mm_slli_pi16(dst2, 11); /* dst2 << 11 -> dst2 */
-
-				mm_res = dst2; /* RED -> mm_res */
-
-				/* green -- process the bits in place */
-				src2 = src1;
-				src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */
-
-				dst2 = dst1;
-				dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */
-
-				/* blend */
-				src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
-				src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
-				src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
-				dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
-
-				mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */
-
-				/* blue */
-				src2 = src1;
-				src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */
-
-				dst2 = dst1;
-				dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */
-
-				/* blend */
-				src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
-				src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
-				src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
-				dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
-				dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */
-
-				mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */
-
-				*(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */
-
-				srcp += 4;
-				dstp += 4;
-			}, width);
-			/* *INDENT-ON* */
+            /* *INDENT-OFF* */
+            DUFFS_LOOP_124(
+            {
+                s = *srcp++;
+                d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x07e0f81f;
+                d = (d | d << 16) & 0x07e0f81f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x07e0f81f;
+                *dstp++ = (Uint16)(d | d >> 16);
+            },{
+                s = *srcp++;
+                d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x07e0f81f;
+                d = (d | d << 16) & 0x07e0f81f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x07e0f81f;
+                *dstp++ = (Uint16)(d | d >> 16);
+                s = *srcp++;
+                d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x07e0f81f;
+                d = (d | d << 16) & 0x07e0f81f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x07e0f81f;
+                *dstp++ = (Uint16)(d | d >> 16);
+            },{
+                src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */
+                dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */
+
+                /* red */
+                src2 = src1;
+                src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 [000r 000r 000r 000r] */
+
+                dst2 = dst1;
+                dst2 = _mm_srli_pi16(dst2, 11); /* dst2 >> 11 -> dst2 [000r 000r 000r 000r] */
+
+                /* blend */
+                src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+                src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+                src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
+                dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+                dst2 = _mm_slli_pi16(dst2, 11); /* dst2 << 11 -> dst2 */
+
+                mm_res = dst2; /* RED -> mm_res */
+
+                /* green -- process the bits in place */
+                src2 = src1;
+                src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */
+
+                dst2 = dst1;
+                dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */
+
+                /* blend */
+                src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+                src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+                src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
+                dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+
+                mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */
+
+                /* blue */
+                src2 = src1;
+                src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */
+
+                dst2 = dst1;
+                dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */
+
+                /* blend */
+                src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+                src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+                src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
+                dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+                dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */
+
+                mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */
+
+                *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */
+
+                srcp += 4;
+                dstp += 4;
+            }, width);
+            /* *INDENT-ON* */
             srcp += srcskip;
             dstp += dstskip;
         }
@@ -865,103 +865,103 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
         bmask = _mm_set_pi32(0x001F001F, 0x001F001F);   /* MASKBLUE -> bmask */
 
         while (height--) {
-			/* *INDENT-OFF* */
-			DUFFS_LOOP_124(
-			{
-				s = *srcp++;
-				d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x03e07c1f;
-				d = (d | d << 16) & 0x03e07c1f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x03e07c1f;
-				*dstp++ = (Uint16)(d | d >> 16);
-			},{
-				s = *srcp++;
-				d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x03e07c1f;
-				d = (d | d << 16) & 0x03e07c1f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x03e07c1f;
-				*dstp++ = (Uint16)(d | d >> 16);
-			        s = *srcp++;
-				d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x03e07c1f;
-				d = (d | d << 16) & 0x03e07c1f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x03e07c1f;
-				*dstp++ = (Uint16)(d | d >> 16);
-			},{
-				src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */
-				dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */
-
-				/* red -- process the bits in place */
-				src2 = src1;
-				src2 = _mm_and_si64(src2, rmask); /* src & MASKRED -> src2 */
-
-				dst2 = dst1;
-				dst2 = _mm_and_si64(dst2, rmask); /* dst & MASKRED -> dst2 */
-
-				/* blend */
-				src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
-				src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
-				src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
-				dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
-				dst2 = _mm_and_si64(dst2, rmask); /* dst2 & MASKRED -> dst2 */
-
-				mm_res = dst2; /* RED -> mm_res */
-				
-				/* green -- process the bits in place */
-				src2 = src1;
-				src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */
-
-				dst2 = dst1;
-				dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */
-
-				/* blend */
-				src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
-				src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
-				src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
-				dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
-
-				mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */
-
-				/* blue */
-				src2 = src1; /* src -> src2 */
-				src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */
-
-				dst2 = dst1; /* dst -> dst2 */
-				dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */
-
-				/* blend */
-				src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
-				src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
-				src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
-				dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
-				dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */
-
-				mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */
-
-				*(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */
-
-				srcp += 4;
-				dstp += 4;
-			}, width);
-			/* *INDENT-ON* */
+            /* *INDENT-OFF* */
+            DUFFS_LOOP_124(
+            {
+                s = *srcp++;
+                d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x03e07c1f;
+                d = (d | d << 16) & 0x03e07c1f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x03e07c1f;
+                *dstp++ = (Uint16)(d | d >> 16);
+            },{
+                s = *srcp++;
+                d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x03e07c1f;
+                d = (d | d << 16) & 0x03e07c1f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x03e07c1f;
+                *dstp++ = (Uint16)(d | d >> 16);
+                    s = *srcp++;
+                d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x03e07c1f;
+                d = (d | d << 16) & 0x03e07c1f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x03e07c1f;
+                *dstp++ = (Uint16)(d | d >> 16);
+            },{
+                src1 = *(__m64*)srcp; /* 4 src pixels -> src1 */
+                dst1 = *(__m64*)dstp; /* 4 dst pixels -> dst1 */
+
+                /* red -- process the bits in place */
+                src2 = src1;
+                src2 = _mm_and_si64(src2, rmask); /* src & MASKRED -> src2 */
+
+                dst2 = dst1;
+                dst2 = _mm_and_si64(dst2, rmask); /* dst & MASKRED -> dst2 */
+
+                /* blend */
+                src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+                src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+                src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
+                dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+                dst2 = _mm_and_si64(dst2, rmask); /* dst2 & MASKRED -> dst2 */
+
+                mm_res = dst2; /* RED -> mm_res */
+                
+                /* green -- process the bits in place */
+                src2 = src1;
+                src2 = _mm_and_si64(src2, gmask); /* src & MASKGREEN -> src2 */
+
+                dst2 = dst1;
+                dst2 = _mm_and_si64(dst2, gmask); /* dst & MASKGREEN -> dst2 */
+
+                /* blend */
+                src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+                src2 = _mm_mulhi_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+                src2 = _mm_slli_pi16(src2, 5); /* src2 << 5 -> src2 */
+                dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+
+                mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN -> mm_res */
+
+                /* blue */
+                src2 = src1; /* src -> src2 */
+                src2 = _mm_and_si64(src2, bmask); /* src & MASKBLUE -> src2[000b 000b 000b 000b] */
+
+                dst2 = dst1; /* dst -> dst2 */
+                dst2 = _mm_and_si64(dst2, bmask); /* dst & MASKBLUE -> dst2[000b 000b 000b 000b] */
+
+                /* blend */
+                src2 = _mm_sub_pi16(src2, dst2);/* src - dst -> src2 */
+                src2 = _mm_mullo_pi16(src2, mm_alpha); /* src2 * alpha -> src2 */
+                src2 = _mm_srli_pi16(src2, 11); /* src2 >> 11 -> src2 */
+                dst2 = _mm_add_pi16(src2, dst2); /* src2 + dst2 -> dst2 */
+                dst2 = _mm_and_si64(dst2, bmask); /* dst2 & MASKBLUE -> dst2 */
+
+                mm_res = _mm_or_si64(mm_res, dst2); /* RED | GREEN | BLUE -> mm_res */
+
+                *(__m64*)dstp = mm_res; /* mm_res -> 4 dst pixels */
+
+                srcp += 4;
+                dstp += 4;
+            }, width);
+            /* *INDENT-ON* */
             srcp += srcskip;
             dstp += dstskip;
         }
@@ -988,22 +988,22 @@ Blit565to565SurfaceAlpha(SDL_BlitInfo * info)
         alpha >>= 3;            /* downscale alpha to 5 bits */
 
         while (height--) {
-			/* *INDENT-OFF* */
-			DUFFS_LOOP4({
-				Uint32 s = *srcp++;
-				Uint32 d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x07e0f81f;
-				d = (d | d << 16) & 0x07e0f81f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x07e0f81f;
-				*dstp++ = (Uint16)(d | d >> 16);
-			}, width);
-			/* *INDENT-ON* */
+            /* *INDENT-OFF* */
+            DUFFS_LOOP4({
+                Uint32 s = *srcp++;
+                Uint32 d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x07e0f81f;
+                d = (d | d << 16) & 0x07e0f81f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x07e0f81f;
+                *dstp++ = (Uint16)(d | d >> 16);
+            }, width);
+            /* *INDENT-ON* */
             srcp += srcskip;
             dstp += dstskip;
         }
@@ -1027,22 +1027,22 @@ Blit555to555SurfaceAlpha(SDL_BlitInfo * info)
         alpha >>= 3;            /* downscale alpha to 5 bits */
 
         while (height--) {
-			/* *INDENT-OFF* */
-			DUFFS_LOOP4({
-				Uint32 s = *srcp++;
-				Uint32 d = *dstp;
-				/*
-				 * shift out the middle component (green) to
-				 * the high 16 bits, and process all three RGB
-				 * components at the same time.
-				 */
-				s = (s | s << 16) & 0x03e07c1f;
-				d = (d | d << 16) & 0x03e07c1f;
-				d += (s - d) * alpha >> 5;
-				d &= 0x03e07c1f;
-				*dstp++ = (Uint16)(d | d >> 16);
-			}, width);
-			/* *INDENT-ON* */
+            /* *INDENT-OFF* */
+            DUFFS_LOOP4({
+                Uint32 s = *srcp++;
+                Uint32 d = *dstp;
+                /*
+                 * shift out the middle component (green) to
+                 * the high 16 bits, and process all three RGB
+                 * components at the same time.
+                 */
+                s = (s | s << 16) & 0x03e07c1f;
+                d = (d | d << 16) & 0x03e07c1f;
+                d += (s - d) * alpha >> 5;
+                d &= 0x03e07c1f;
+                *dstp++ = (Uint16)(d | d >> 16);
+            }, width);
+            /* *INDENT-ON* */
             srcp += srcskip;
             dstp += dstskip;
         }
@@ -1061,35 +1061,35 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info)
     int dstskip = info->dst_skip >> 1;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4({
-		Uint32 s = *srcp;
-		unsigned alpha = s >> 27; /* downscale alpha to 5 bits */
-		/* FIXME: Here we special-case opaque alpha since the
-		   compositioning used (>>8 instead of /255) doesn't handle
-		   it correctly. Also special-case alpha=0 for speed?
-		   Benchmark this! */
-		if(alpha) {   
-		  if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
-		    *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3  & 0x1f));
-		  } else {
-		    Uint32 d = *dstp;
-		    /*
-		     * convert source and destination to G0RAB65565
-		     * and blend all components at the same time
-		     */
-		    s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800)
-		      + (s >> 3 & 0x1f);
-		    d = (d | d << 16) & 0x07e0f81f;
-		    d += (s - d) * alpha >> 5;
-		    d &= 0x07e0f81f;
-		    *dstp = (Uint16)(d | d >> 16);
-		  }
-		}
-		srcp++;
-		dstp++;
-	    }, width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4({
+        Uint32 s = *srcp;
+        unsigned alpha = s >> 27; /* downscale alpha to 5 bits */
+        /* FIXME: Here we special-case opaque alpha since the
+           compositioning used (>>8 instead of /255) doesn't handle
+           it correctly. Also special-case alpha=0 for speed?
+           Benchmark this! */
+        if(alpha) {   
+          if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
+            *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3  & 0x1f));
+          } else {
+            Uint32 d = *dstp;
+            /*
+             * convert source and destination to G0RAB65565
+             * and blend all components at the same time
+             */
+            s = ((s & 0xfc00) << 11) + (s >> 8 & 0xf800)
+              + (s >> 3 & 0x1f);
+            d = (d | d << 16) & 0x07e0f81f;
+            d += (s - d) * alpha >> 5;
+            d &= 0x07e0f81f;
+            *dstp = (Uint16)(d | d >> 16);
+          }
+        }
+        srcp++;
+        dstp++;
+        }, width);
+        /* *INDENT-ON* */
         srcp += srcskip;
         dstp += dstskip;
     }
@@ -1107,36 +1107,36 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info)
     int dstskip = info->dst_skip >> 1;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4({
-		unsigned alpha;
-		Uint32 s = *srcp;
-		alpha = s >> 27; /* downscale alpha to 5 bits */
-		/* FIXME: Here we special-case opaque alpha since the
-		   compositioning used (>>8 instead of /255) doesn't handle
-		   it correctly. Also special-case alpha=0 for speed?
-		   Benchmark this! */
-		if(alpha) {   
-		  if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
-		    *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3  & 0x1f));
-		  } else {
-		    Uint32 d = *dstp;
-		    /*
-		     * convert source and destination to G0RAB65565
-		     * and blend all components at the same time
-		     */
-		    s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00)
-		      + (s >> 3 & 0x1f);
-		    d = (d | d << 16) & 0x03e07c1f;
-		    d += (s - d) * alpha >> 5;
-		    d &= 0x03e07c1f;
-		    *dstp = (Uint16)(d | d >> 16);
-		  }
-		}
-		srcp++;
-		dstp++;
-	    }, width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4({
+        unsigned alpha;
+        Uint32 s = *srcp;
+        alpha = s >> 27; /* downscale alpha to 5 bits */
+        /* FIXME: Here we special-case opaque alpha since the
+           compositioning used (>>8 instead of /255) doesn't handle
+           it correctly. Also special-case alpha=0 for speed?
+           Benchmark this! */
+        if(alpha) {   
+          if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
+            *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3  & 0x1f));
+          } else {
+            Uint32 d = *dstp;
+            /*
+             * convert source and destination to G0RAB65565
+             * and blend all components at the same time
+             */
+            s = ((s & 0xf800) << 10) + (s >> 9 & 0x7c00)
+              + (s >> 3 & 0x1f);
+            d = (d | d << 16) & 0x03e07c1f;
+            d += (s - d) * alpha >> 5;
+            d &= 0x03e07c1f;
+            *dstp = (Uint16)(d | d >> 16);
+          }
+        }
+        srcp++;
+        dstp++;
+        }, width);
+        /* *INDENT-ON* */
         srcp += srcskip;
         dstp += dstskip;
     }
@@ -1163,18 +1163,18 @@ BlitNtoNSurfaceAlpha(SDL_BlitInfo * info)
 
     if (sA) {
         while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4(
-	    {
-		DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
-		DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
-		ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
-		ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
-		src += srcbpp;
-		dst += dstbpp;
-	    },
-	    width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4(
+        {
+        DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
+        DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
+        ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
+        ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+        src += srcbpp;
+        dst += dstbpp;
+        },
+        width);
+        /* *INDENT-ON* */
             src += srcskip;
             dst += dstskip;
         }
@@ -1202,21 +1202,21 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info)
     const unsigned sA = info->a;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4(
-	    {
-		RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
-		if(sA && Pixel != ckey) {
-		    RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
-		    DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
-		    ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
-		    ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
-		}
-		src += srcbpp;
-		dst += dstbpp;
-	    },
-	    width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4(
+        {
+        RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
+        if(sA && Pixel != ckey) {
+            RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
+            DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
+            ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
+            ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+        }
+        src += srcbpp;
+        dst += dstbpp;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
@@ -1245,20 +1245,20 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info)
     dstbpp = dstfmt->BytesPerPixel;
 
     while (height--) {
-	    /* *INDENT-OFF* */
-	    DUFFS_LOOP4(
-	    {
-		DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
-		if(sA) {
-		    DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
-		    ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
-		    ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
-		}
-		src += srcbpp;
-		dst += dstbpp;
-	    },
-	    width);
-	    /* *INDENT-ON* */
+        /* *INDENT-OFF* */
+        DUFFS_LOOP4(
+        {
+        DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
+        if(sA) {
+            DISEMBLE_RGBA(dst, dstbpp, dstfmt, Pixel, dR, dG, dB, dA);
+            ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA);
+            ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
+        }
+        src += srcbpp;
+        dst += dstbpp;
+        },
+        width);
+        /* *INDENT-ON* */
         src += srcskip;
         dst += dstskip;
     }
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index 96f02cd..c3b4376 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -836,7 +836,7 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
     /* max 2 values plus terminator. */
     EGLint attribs[3];
     int attr = 0;
-	
+
     EGLSurface * surface;
 
     if (SDL_EGL_ChooseConfig(_this) != 0) {
@@ -868,7 +868,7 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
             return EGL_NO_SURFACE;
         }
     }
-	
+
     attribs[attr++] = EGL_NONE;
     
     surface = _this->egl_data->eglCreateWindowSurface(
diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c
index 2e26395..c2e4163 100644
--- a/src/video/SDL_pixels.c
+++ b/src/video/SDL_pixels.c
@@ -326,7 +326,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
         if (Rmask == 0) {
             return SDL_PIXELFORMAT_RGB555;
         }
-	/* fallthrough */
+    /* fallthrough */
     case 16:
         if (Rmask == 0) {
             return SDL_PIXELFORMAT_RGB565;
diff --git a/src/video/SDL_shape_internals.h b/src/video/SDL_shape_internals.h
index 3af175c..49a8786 100644
--- a/src/video/SDL_shape_internals.h
+++ b/src/video/SDL_shape_internals.h
@@ -36,21 +36,21 @@ extern "C" {
 #endif
 
 typedef struct {
-	struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
+    struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
 } SDL_QuadTreeChildren;
 
 typedef union {
-	SDL_QuadTreeChildren children;
-	SDL_Rect shape;
+    SDL_QuadTreeChildren children;
+    SDL_Rect shape;
 } SDL_ShapeUnion;
 
 typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind;
 
 typedef struct {
-	SDL_ShapeKind kind;
-	SDL_ShapeUnion data;
+    SDL_ShapeKind kind;
+    SDL_ShapeUnion data;
 } SDL_ShapeTree;
-	
+
 typedef void(*SDL_TraversalFunction)(SDL_ShapeTree*,void*);
 
 extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb);
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index ae6fee9..336fdaa 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1540,11 +1540,12 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
         return NULL;
     }
 
-	// Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation,
-	// but it's important or window focus will get broken on windows!
+    /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation,
+     * but it's important or window focus will get broken on windows!
+     */
 #if !defined(__WIN32__)
-	if (window->flags & SDL_WINDOW_MINIMIZED) {
-		window->flags &= ~SDL_WINDOW_MINIMIZED;
+    if (window->flags & SDL_WINDOW_MINIMIZED) {
+        window->flags &= ~SDL_WINDOW_MINIMIZED;
     }
 #endif
 
diff --git a/src/video/SDL_vulkan_utils.c b/src/video/SDL_vulkan_utils.c
index d4cbed4..1b242f1 100644
--- a/src/video/SDL_vulkan_utils.c
+++ b/src/video/SDL_vulkan_utils.c
@@ -123,10 +123,10 @@ VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
     {
         retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null
     }
-	else
-	{
-		retval = SDL_calloc(count, sizeof(VkExtensionProperties));
-	}
+    else
+    {
+        retval = SDL_calloc(count, sizeof(VkExtensionProperties));
+    }
     if(!retval)
     {
         SDL_OutOfMemory();
diff --git a/src/video/SDL_yuv.c b/src/video/SDL_yuv.c
index 50910a5..7c1e6b4 100644
--- a/src/video/SDL_yuv.c
+++ b/src/video/SDL_yuv.c
@@ -89,10 +89,10 @@ static SDL_bool IsPacked4Format(Uint32 format)
 }
 
 static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch,
-	                    const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride)
+                        const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride)
 {
-	const Uint8 *planes[3] = { NULL, NULL, NULL };
-	int pitches[3] = { 0, 0, 0 };
+    const Uint8 *planes[3] = { NULL, NULL, NULL };
+    int pitches[3] = { 0, 0, 0 };
 
     switch (format) {
     case SDL_PIXELFORMAT_YV12:
@@ -180,10 +180,10 @@ static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, i
 
 static SDL_bool yuv_rgb_sse(
     Uint32 src_format, Uint32 dst_format,
-	Uint32 width, Uint32 height, 
-	const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, 
-	Uint8 *rgb, Uint32 rgb_stride, 
-	YCbCrType yuv_type)
+    Uint32 width, Uint32 height, 
+    const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, 
+    Uint8 *rgb, Uint32 rgb_stride, 
+    YCbCrType yuv_type)
 {
 #ifdef __SSE2__
     if (!SDL_HasSSE2()) {
@@ -289,10 +289,10 @@ static SDL_bool yuv_rgb_sse(
 
 static SDL_bool yuv_rgb_std(
     Uint32 src_format, Uint32 dst_format,
-	Uint32 width, Uint32 height, 
-	const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, 
-	Uint8 *rgb, Uint32 rgb_stride, 
-	YCbCrType yuv_type)
+    Uint32 width, Uint32 height, 
+    const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, 
+    Uint8 *rgb, Uint32 rgb_stride, 
+    YCbCrType yuv_type)
 {
     if (src_format == SDL_PIXELFORMAT_YV12 ||
         src_format == SDL_PIXELFORMAT_IYUV) {
@@ -395,7 +395,7 @@ SDL_ConvertPixels_YUV_to_RGB(int width, int height,
          Uint32 src_format, const void *src, int src_pitch,
          Uint32 dst_format, void *dst, int dst_pitch)
 {
-	const Uint8 *y = NULL;
+    const Uint8 *y = NULL;
     const Uint8 *u = NULL;
     const Uint8 *v = NULL;
     Uint32 y_stride = 0;
@@ -553,7 +553,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
             Uint32 y_stride, uv_stride, y_skip, uv_skip;
 
             GetYUVPlanes(width, height, dst_format, dst, dst_pitch,
-	                     (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v,
+                         (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v,
                          &y_stride, &uv_stride);
             plane_interleaved_uv = (plane_y + height * y_stride);
             y_skip = (y_stride - width);
diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index 3cf5040..589461a 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -214,12 +214,12 @@ Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * h
 void
 Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate)
 {
-	SDL_VideoDevice* device;
-	SDL_VideoDisplay *display;
+    SDL_VideoDevice* device;
+    SDL_VideoDisplay *display;
     Android_SurfaceWidth = surfaceWidth;
     Android_SurfaceHeight = surfaceHeight;
-	Android_DeviceWidth = deviceWidth;
-	Android_DeviceHeight = deviceHeight;
+    Android_DeviceWidth = deviceWidth;
+    Android_DeviceHeight = deviceHeight;
     Android_ScreenFormat = format;
     Android_ScreenRate = rate;
 
diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m
index 38f4ba6..76d235e 100644
--- a/src/video/cocoa/SDL_cocoaevents.m
+++ b/src/video/cocoa/SDL_cocoaevents.m
@@ -390,8 +390,8 @@ Cocoa_RegisterApp(void)
 
         if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
             [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
-		}
-		
+        }
+
         if ([NSApp mainMenu] == nil) {
             CreateApplicationMenus();
         }
diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m
index f28b743..8b7a697 100644
--- a/src/video/cocoa/SDL_cocoametalview.m
+++ b/src/video/cocoa/SDL_cocoametalview.m
@@ -39,7 +39,7 @@
 /* Return a Metal-compatible layer. */
 + (Class)layerClass
 {
-	return NSClassFromString(@"CAMetalLayer");
+    return NSClassFromString(@"CAMetalLayer");
 }
 
 /* Indicate the view wants to draw using a backing layer instead of drawRect. */
@@ -59,7 +59,7 @@
 - (instancetype)initWithFrame:(NSRect)frame
                         scale:(CGFloat)scale
 {
-	if ((self = [super initWithFrame:frame])) {
+    if ((self = [super initWithFrame:frame])) {
         _tag = METALVIEW_TAG;
         self.wantsLayer = YES;
 
@@ -71,7 +71,7 @@
         self.layer.contentsScale = scale;
     }
   
-	return self;
+    return self;
 }
 
 /* Set the size of the metal drawables when the view is resized. */
diff --git a/src/video/cocoa/SDL_cocoamousetap.m b/src/video/cocoa/SDL_cocoamousetap.m
index 3c4fcf2..05a7d77 100644
--- a/src/video/cocoa/SDL_cocoamousetap.m
+++ b/src/video/cocoa/SDL_cocoamousetap.m
@@ -211,7 +211,7 @@ Cocoa_InitMouseEventTap(SDL_MouseData* driverdata)
             tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata);
             if (tapdata->thread) {
                 /* Success - early out. Ownership transferred to thread. */
-            	return;
+                return;
             }
             CFRelease(tapdata->tap);
         }
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 0cf7ec3..71ff8db 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -241,7 +241,7 @@ ScheduleContextUpdates(SDL_WindowData *data)
 static int
 GetHintCtrlClickEmulateRightClick()
 {
-	return SDL_GetHintBoolean(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, SDL_FALSE);
+    return SDL_GetHintBoolean(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, SDL_FALSE);
 }
 
 static NSUInteger
@@ -908,7 +908,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
     switch ([theEvent buttonNumber]) {
     case 0:
         if (([theEvent modifierFlags] & NSEventModifierFlagControl) &&
-		    GetHintCtrlClickEmulateRightClick()) {
+            GetHintCtrlClickEmulateRightClick()) {
             wasCtrlLeft = YES;
             button = SDL_BUTTON_RIGHT;
         } else {
diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c
index e253c58..8740ce1 100644
--- a/src/video/directfb/SDL_DirectFB_video.c
+++ b/src/video/directfb/SDL_DirectFB_video.c
@@ -324,7 +324,7 @@ static const struct {
     { DSPF_YUY2, SDL_PIXELFORMAT_YUY2 },                /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */
     { DSPF_UYVY, SDL_PIXELFORMAT_UYVY },                /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */
     { DSPF_RGB555, SDL_PIXELFORMAT_RGB555 },            /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */
-    { DSPF_ABGR, SDL_PIXELFORMAT_ABGR8888 },		/* 32 bit ABGR (4  byte, alpha 8@24, blue 8@16, green 8@8, red 8@0) */
+    { DSPF_ABGR, SDL_PIXELFORMAT_ABGR8888 },            /* 32 bit ABGR (4  byte, alpha 8@24, blue 8@16, green 8@8, red 8@0) */
 #if (ENABLE_LUT8)
     { DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 },              /* 8 bit LUT (8 bit color and alpha lookup from palette) */
 #endif
diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h
index b385540..b22f74b 100644
--- a/src/video/haiku/SDL_BWin.h
+++ b/src/video/haiku/SDL_BWin.h
@@ -538,7 +538,7 @@ private:
         msg.AddInt32("key-state", keyState);
         msg.AddInt32("key-scancode", keyCode);
         if (keyUtf8 != NULL) {
-        	msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len);
+            msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len);
         }
         be_app->PostMessage(&msg);
     }
diff --git a/src/video/haiku/SDL_bclipboard.cc b/src/video/haiku/SDL_bclipboard.cc
index 0727fd1..3138603 100644
--- a/src/video/haiku/SDL_bclipboard.cc
+++ b/src/video/haiku/SDL_bclipboard.cc
@@ -36,54 +36,54 @@ extern "C" {
 #endif
 
 int HAIKU_SetClipboardText(_THIS, const char *text) {
-	BMessage *clip = NULL;
-	if(be_clipboard->Lock()) {
-		be_clipboard->Clear();
-		if((clip = be_clipboard->Data())) {
-			/* Presumably the string of characters is ascii-format */
-			ssize_t asciiLength = 0;
-			for(; text[asciiLength] != 0; ++asciiLength) {}
-			clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength);
-			be_clipboard->Commit();
-		}
-		be_clipboard->Unlock();
-	}
-	return 0;
+    BMessage *clip = NULL;
+    if(be_clipboard->Lock()) {
+        be_clipboard->Clear();
+        if((clip = be_clipboard->Data())) {
+            /* Presumably the string of characters is ascii-format */
+            ssize_t asciiLength = 0;
+            for(; text[asciiLength] != 0; ++asciiLength) {}
+            clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength);
+            be_clipboard->Commit();
+        }
+        be_clipboard->Unlock();
+    }
+    return 0;
 }
 
 char *HAIKU_GetClipboardText(_THIS) {
-	BMessage *clip = NULL;
-	const char *text = NULL;	
-	ssize_t length;
-	char *result;
-	if(be_clipboard->Lock()) {
-		if((clip = be_clipboard->Data())) {
-			/* Presumably the string of characters is ascii-format */
-			clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
-				&length);
-		}
-		be_clipboard->Unlock();
-	} 
-	
-	if (!text) {
-		result = SDL_strdup("");
-	} else {
-		/* Copy the data and pass on to SDL */
-		result = (char *)SDL_malloc((length + 1) * sizeof(char));
-		SDL_strlcpy(result, text, length + 1);
-	}
-	
-	return result;
+    BMessage *clip = NULL;
+    const char *text = NULL;    
+    ssize_t length;
+    char *result;
+    if(be_clipboard->Lock()) {
+        if((clip = be_clipboard->Data())) {
+            /* Presumably the string of characters is ascii-format */
+            clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
+                &length);
+        }
+        be_clipboard->Unlock();
+    } 
+    
+    if (!text) {
+        result = SDL_strdup("");
+    } else {
+        /* Copy the data and pass on to SDL */
+        result = (char *)SDL_malloc((length + 1) * sizeof(char));
+        SDL_strlcpy(result, text, length + 1);
+    }
+    
+    return result;
 }
 
 SDL_bool HAIKU_HasClipboardText(_THIS) {
-	SDL_bool result = SDL_FALSE;
-	char *text = HAIKU_GetClipboardText(_this);
-	if (text) {
-		result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
-		SDL_free(text);
-	} 
-	return result;
+    SDL_bool result = SDL_FALSE;
+    char *text = HAIKU_GetClipboardText(_this);
+    if (text) {
+        result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
+        SDL_free(text);
+    } 
+    return result;
 }
 
 #ifdef __cplusplus
diff --git a/src/video/haiku/SDL_bevents.cc b/src/video/haiku/SDL_bevents.cc
index e3884d3..c918ab2 100644
--- a/src/video/haiku/SDL_bevents.cc
+++ b/src/video/haiku/SDL_bevents.cc
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 
 void HAIKU_PumpEvents(_THIS) {
-	/* Since the event thread is its own thread, this isn't really necessary */
+    /* Since the event thread is its own thread, this isn't really necessary */
 }
 
 #ifdef __cplusplus
diff --git a/src/video/haiku/SDL_bframebuffer.cc b/src/video/haiku/SDL_bframebuffer.cc
index 848d735..9675706 100644
--- a/src/video/haiku/SDL_bframebuffer.cc
+++ b/src/video/haiku/SDL_bframebuffer.cc
@@ -40,158 +40,158 @@ static int32 HAIKU_UpdateOnce(SDL_Window *window);
 #endif
 
 static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
-	return ((SDL_BWin*)(window->driverdata));
+    return ((SDL_BWin*)(window->driverdata));
 }
 
 static SDL_INLINE SDL_BApp *_GetBeApp() {
-	return ((SDL_BApp*)be_app);
+    return ((SDL_BApp*)be_app);
 }
 
 int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
                                        Uint32 * format,
                                        void ** pixels, int *pitch) {
-	SDL_BWin *bwin = _ToBeWin(window);
-	BScreen bscreen;
-	if(!bscreen.IsValid()) {
-		return -1;
-	}
-
-	while(!bwin->Connected()) { snooze(100); }
-	
-	/* Make sure we have exclusive access to frame buffer data */
-	bwin->LockBuffer();
-
-	/* format */
-	display_mode bmode;
-	bscreen.GetMode(&bmode);
-	int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space);
-	*format = HAIKU_BPPToSDLPxFormat(bpp);
-
-	/* Create the new bitmap object */
-	BBitmap *bitmap = bwin->GetBitmap();
-
-	if(bitmap) {
-		delete bitmap;
-	}
-	bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
-			false,	/* Views not accepted */
-			true);	/* Contiguous memory required */
-			
-	if(bitmap->InitCheck() != B_OK) {
-		delete bitmap;
-		return SDL_SetError("Could not initialize back buffer!");
-	}
-
-
-	bwin->SetBitmap(bitmap);
-	
-	/* Set the pixel pointer */
-	*pixels = bitmap->Bits();
-
-	/* pitch = width of window, in bytes */
-	*pitch = bitmap->BytesPerRow();
-
-	bwin->SetBufferExists(true);
-	bwin->SetTrashBuffer(false);
-	bwin->UnlockBuffer();
-	return 0;
+    SDL_BWin *bwin = _ToBeWin(window);
+    BScreen bscreen;
+    if(!bscreen.IsValid()) {
+        return -1;
+    }
+
+    while(!bwin->Connected()) { snooze(100); }
+    
+    /* Make sure we have exclusive access to frame buffer data */
+    bwin->LockBuffer();
+
+    /* format */
+    display_mode bmode;
+    bscreen.GetMode(&bmode);
+    int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space);
+    *format = HAIKU_BPPToSDLPxFormat(bpp);
+
+    /* Create the new bitmap object */
+    BBitmap *bitmap = bwin->GetBitmap();
+
+    if(bitmap) {
+        delete bitmap;
+    }
+    bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
+            false,    /* Views not accepted */
+            true);    /* Contiguous memory required */
+            
+    if(bitmap->InitCheck() != B_OK) {
+        delete bitmap;
+        return SDL_SetError("Could not initialize back buffer!");
+    }
+
+
+    bwin->SetBitmap(bitmap);
+    
+    /* Set the pixel pointer */
+    *pixels = bitmap->Bits();
+
+    /* pitch = width of window, in bytes */
+    *pitch = bitmap->BytesPerRow();
+
+    bwin->SetBufferExists(true);
+    bwin->SetTrashBuffer(false);
+    bwin->UnlockBuffer();
+    return 0;
 }
 
 
 
 int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
                                       const SDL_Rect * rects, int numrects) {
-	if(!window)
-		return 0;
+    if(!window)
+        return 0;
 
-	SDL_BWin *bwin = _ToBeWin(window);
+    SDL_BWin *bwin = _ToBeWin(window);
 
-#ifdef DRAWTHREAD	
-	bwin->LockBuffer();
-	bwin->SetBufferDirty(true);
-	bwin->UnlockBuffer();
+#ifdef DRAWTHREAD    
+    bwin->LockBuffer();
+    bwin->SetBufferDirty(true);
+    bwin->UnlockBuffer();
 #else
-	bwin->SetBufferDirty(true);
-	HAIKU_UpdateOnce(window);
+    bwin->SetBufferDirty(true);
+    HAIKU_UpdateOnce(window);
 #endif
 
-	return 0;
+    return 0;
 }
 
 int32 HAIKU_DrawThread(void *data) {
-	SDL_BWin *bwin = (SDL_BWin*)data;
-	
-	BScreen bscreen;
-	if(!bscreen.IsValid()) {
-		return -1;
-	}
-
-	while(bwin->ConnectionEnabled()) {
-		if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) {
-			bwin->LockBuffer();
-			BBitmap *bitmap = NULL;
-			bitmap = bwin->GetBitmap();
-			int32 windowPitch = bitmap->BytesPerRow();
-			int32 bufferPitch = bwin->GetRowBytes();
-			uint8 *windowpx;
-			uint8 *bufferpx;
-
-			int32 BPP = bwin->GetBytesPerPx();
-			int32 windowSub = bwin->GetFbX() * BPP +
-						  bwin->GetFbY() * windowPitch;
-			clipping_rect *clips = bwin->GetClips();
-			int32 numClips = bwin->GetNumClips();
-			int i, y;
-
-			/* Blit each clipping rectangle */
-			bscreen.WaitForRetrace();
-			for(i = 0; i < numClips; ++i) {
-				/* Get addresses of the start of each clipping rectangle */
-				int32 width = clips[i].right - clips[i].left + 1;
-				int32 height = clips[i].bottom - clips[i].top + 1;
-				bufferpx = bwin->GetBufferPx() + 
-					clips[i].top * bufferPitch + clips[i].left * BPP;
-				windowpx = (uint8*)bitmap->Bits() + 
-					clips[i].top * windowPitch + clips[i].left * BPP -
-					windowSub;
-
-				/* Copy each row of pixels from the window buffer into the frame
-				   buffer */
-				for(y = 0; y < height; ++y)
-				{
-
-					if(bwin->CanTrashWindowBuffer()) {
-						goto escape;	/* Break out before the buffer is killed */
-					}
-
-					memcpy(bufferpx, windowpx, width * BPP);
-					bufferpx += bufferPitch;
-					windowpx += windowPitch;
-				}
-			}
-
-			bwin->SetBufferDirty(false);
+    SDL_BWin *bwin = (SDL_BWin*)data;
+    
+    BScreen bscreen;
+    if(!bscreen.IsValid()) {
+        return -1;
+    }
+
+    while(bwin->ConnectionEnabled()) {
+        if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) {
+            bwin->LockBuffer();
+            BBitmap *bitmap = NULL;
+            bitmap = bwin->GetBitmap();
+            int32 windowPitch = bitmap->BytesPerRow();
+            int32 bufferPitch = bwin->GetRowBytes();
+            uint8 *windowpx;
+            uint8 *bufferpx;
+
+            int32 BPP = bwin->GetBytesPerPx();
+            int32 windowSub = bwin->GetFbX() * BPP +
+                          bwin->GetFbY() * windowPitch;
+            clipping_rect *clips = bwin->GetClips();
+            int32 numClips = bwin->GetNumClips();
+            int i, y;
+
+            /* Blit each clipping rectangle */
+            bscreen.WaitForRetrace();
+            for(i = 0; i < numClips; ++i) {
+                /* Get addresses of the start of each clipping rectangle */
+                int32 width = clips[i].right - clips[i].left + 1;
+                int32 height = clips[i].bottom - clips[i].top + 1;
+                bufferpx = bwin->GetBufferPx() + 
+                    clips[i].top * bufferPitch + clips[i].left * BPP;
+                windowpx = (uint8*)bitmap->Bits() + 
+                    clips[i].top * windowPitch + clips[i].left * BPP -
+                    windowSub;
+
+                /* Copy each row of pixels from the window buffer into the frame
+                   buffer */
+                for(y = 0; y < height; ++y)
+                {
+
+                    if(bwin->CanTrashWindowBuffer()) {
+                        goto escape;    /* Break out before the buffer is killed */
+                    }
+
+                    memcpy(bufferpx, windowpx, width * BPP);
+                    bufferpx += bufferPitch;
+                    windowpx += windowPitch;
+                }
+            }
+
+            bwin->SetBufferDirty(false);
 escape:
-			bwin->UnlockBuffer();
-		} else {
-			snooze(16000);
-		}
-	}
-	
-	return B_OK;
+            bwin->UnlockBuffer();
+        } else {
+            snooze(16000);
+        }
+    }
+    
+    return B_OK;
 }
 
 void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
-	SDL_BWin *bwin = _ToBeWin(window);
-	
-	bwin->LockBuffer();
-	
-	/* Free and clear the window buffer */
-	BBitmap *bitmap = bwin->GetBitmap();
-	delete bitmap;
-	bwin->SetBitmap(NULL);
-	bwin->SetBufferExists(false);
-	bwin->UnlockBuffer();
+    SDL_BWin *bwin = _ToBeWin(window);
+    
+    bwin->LockBuffer();
+    
+    /* Free and clear the window buffer */
+    BBitmap *bitmap = bwin->GetBitmap();
+    delete bitmap;
+    bwin->SetBitmap(NULL);
+    bwin->SetBufferExists(false);
+    bwin->UnlockBuffer();
 }
 
 
@@ -203,50 +203,50 @@ void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
  */
 #ifndef DRAWTHREAD
 static int32 HAIKU_UpdateOnce(SDL_Window *window) {
-	SDL_BWin *bwin = _ToBeWin(window);
-	BScreen bscreen;
-	if(!bscreen.IsValid()) {
-		return -1;
-	}
-
-	if(bwin->ConnectionEnabled() && bwin->Connected()) {
-		bwin->LockBuffer();
-		int32 windowPitch = window->surface->pitch;
-		int32 bufferPitch = bwin->GetRowBytes();
-		uint8 *windowpx;
-		uint8 *bufferpx;
-
-		int32 BPP = bwin->GetBytesPerPx();
-		uint8 *windowBaseAddress = (uint8*)window->surface->pixels;
-		int32 windowSub = bwin->GetFbX() * BPP +
-						  bwin->GetFbY() * windowPitch;
-		clipping_rect *clips = bwin->GetClips();
-		int32 numClips = bwin->GetNumClips();
-		int i, y;
-
-		/* Blit each clipping rectangle */
-		bscreen.WaitForRetrace();
-		for(i = 0; i < numClips; ++i) {
-			/* Get addresses of the start of each clipping rectangle */
-			int32 width = clips[i].right - clips[i].left + 1;
-			int32 height = clips[i].bottom - clips[i].top + 1;
-			bufferpx = bwin->GetBufferPx() + 
-				clips[i].top * bufferPitch + clips[i].left * BPP;
-			windowpx = windowBaseAddress + 
-				clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
-
-			/* Copy each row of pixels from the window buffer into the frame
-			   buffer */
-			for(y = 0; y < height; ++y)
-			{
-				memcpy(bufferpx, windowpx, width * BPP);
-				bufferpx += bufferPitch;
-				windowpx += windowPitch;
-			}
-		}
-		bwin->UnlockBuffer();
-	}
-	return 0;
+    SDL_BWin *bwin = _ToBeWin(window);
+    BScreen bscreen;
+    if(!bscreen.IsValid()) {
+        return -1;
+    }
+
+    if(bwin->ConnectionEnabled() && bwin->Connected()) {
+        bwin->LockBuffer();
+        int32 windowPitch = window->surface->pitch;
+        int32 bufferPitch = bwin->GetRowBytes();
+        uint8 *windowpx;
+        uint8 *bufferpx;
+
+        int32 BPP = bwin->GetBytesPerPx();
+        uint8 *windowBaseAddress = (uint8*)window->surface->pixels;
+        int32 windowSub = bwin->GetFbX() * BPP +
+                          bwin->GetFbY() * windowPitch;
+        clipping_rect *clips = bwin->GetClips();
+        int32 numClips = bwin->GetNumClips();
+        int i, y;
+
+        /* Blit each clipping rectangle */
+        bscreen.WaitForRetrace();
+        for(i = 0; i < numClips; ++i) {
+            /* Get addresses of the start of each clipping rectangle */
+            int32 width = clips[i].right - clips[i].left + 1;
+            int32 height = clips[i].bottom - clips[i].top + 1;
+            bufferpx = bwin->GetBufferPx() + 
+                clips[i].top * bufferPitch + clips[i].left * BPP;
+            windowpx = windowBaseAddress + 
+                clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
+
+            /* Copy each row of pixels from the window buffer into the frame
+               buffer */
+            for(y = 0; y < height; ++y)
+            {
+                memcpy(bufferpx, windowpx, width * BPP);
+                bufferpx += bufferPitch;
+                windowpx += windowPitch;
+            }
+        }
+        bwin->UnlockBuffer();
+    }
+    return 0;
 }
 #endif
 
diff --git a/src/video/haiku/SDL_bkeyboard.cc b/src/video/haiku/SDL_bkeyboard.cc
index d12d238..9a8b9a4 100644
--- a/src/video/haiku/SDL_bkeyboard.cc
+++ b/src/video/haiku/SDL_bkeyboard.cc
@@ -42,143 +42,143 @@ static SDL_Scancode keymap[KEYMAP_SIZE];
 static int8 keystate[KEYMAP_SIZE];
 
 void HAIKU_InitOSKeymap(void) {
-		for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
-			keymap[i] = SDL_SCANCODE_UNKNOWN;
-		}
-
-		for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
-			keystate[i] = SDL_RELEASED;
-		}
-
-		keymap[0x01]		= SDL_GetScancodeFromKey(SDLK_ESCAPE);
-		keymap[B_F1_KEY]	= SDL_GetScancodeFromKey(SDLK_F1);
-		keymap[B_F2_KEY]	= SDL_GetScancodeFromKey(SDLK_F2);
-		keymap[B_F3_KEY]	= SDL_GetScancodeFromKey(SDLK_F3);
-		keymap[B_F4_KEY]	= SDL_GetScancodeFromKey(SDLK_F4);
-		keymap[B_F5_KEY]	= SDL_GetScancodeFromKey(SDLK_F5);
-		keymap[B_F6_KEY]	= SDL_GetScancodeFromKey(SDLK_F6);
-		keymap[B_F7_KEY]	= SDL_GetScancodeFromKey(SDLK_F7);
-		keymap[B_F8_KEY]	= SDL_GetScancodeFromKey(SDLK_F8);
-		keymap[B_F9_KEY]	= SDL_GetScancodeFromKey(SDLK_F9);
-		keymap[B_F10_KEY]	= SDL_GetScancodeFromKey(SDLK_F10);
-		keymap[B_F11_KEY]	= SDL_GetScancodeFromKey(SDLK_F11);
-		keymap[B_F12_KEY]	= SDL_GetScancodeFromKey(SDLK_F12);
-		keymap[B_PRINT_KEY]	= SDL_GetScancodeFromKey(SDLK_PRINTSCREEN);
-		keymap[B_SCROLL_KEY]	= SDL_GetScancodeFromKey(SDLK_SCROLLLOCK);
-		keymap[B_PAUSE_KEY]	= SDL_GetScancodeFromKey(SDLK_PAUSE);
-		keymap[0x11]		= SDL_GetScancodeFromKey(SDLK_BACKQUOTE);
-		keymap[0x12]		= SDL_GetScancodeFromKey(SDLK_1);
-		keymap[0x13]		= SDL_GetScancodeFromKey(SDLK_2);
-		keymap[0x14]		= SDL_GetScancodeFromKey(SDLK_3);
-		keymap[0x15]		= SDL_GetScancodeFromKey(SDLK_4);
-		keymap[0x16]		= SDL_GetScancodeFromKey(SDLK_5);
-		keymap[0x17]		= SDL_GetScancodeFromKey(SDLK_6);
-		keymap[0x18]		= SDL_GetScancodeFromKey(SDLK_7);
-		keymap[0x19]		= SDL_GetScancodeFromKey(SDLK_8);
-		keymap[0x1a]		= SDL_GetScancodeFromKey(SDLK_9);
-		keymap[0x1b]		= SDL_GetScancodeFromKey(SDLK_0);
-		keymap[0x1c]		= SDL_GetScancodeFromKey(SDLK_MINUS);
-		keymap[0x1d]		= SDL_GetScancodeFromKey(SDLK_EQUALS);
-		keymap[0x1e]		= SDL_GetScancodeFromKey(SDLK_BACKSPACE);
-		keymap[0x1f]		= SDL_GetScancodeFromKey(SDLK_INSERT);
-		keymap[0x20]		= SDL_GetScancodeFromKey(SDLK_HOME);
-		keymap[0x21]		= SDL_GetScancodeFromKey(SDLK_PAGEUP);
-		keymap[0x22]		= SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR);
-		keymap[0x23]		= SDL_GetScancodeFromKey(SDLK_KP_DIVIDE);
-		keymap[0x24]		= SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY);
-		keymap[0x25]		= SDL_GetScancodeFromKey(SDLK_KP_MINUS);
-		keymap[0x26]		= SDL_GetScancodeFromKey(SDLK_TAB);
-		keymap[0x27]		= SDL_GetScancodeFromKey(SDLK_q);
-		keymap[0x28]		= SDL_GetScancodeFromKey(SDLK_w);
-		keymap[0x29]		= SDL_GetScancodeFromKey(SDLK_e);
-		keymap[0x2a]		= SDL_GetScancodeFromKey(SDLK_r);
-		keymap[0x2b]		= SDL_GetScancodeFromKey(SDLK_t);
-		keymap[0x2c]		= SDL_GetScancodeFromKey(SDLK_y);
-		keymap[0x2d]		= SDL_GetScancodeFromKey(SDLK_u);
-		keymap[0x2e]		= SDL_GetScancodeFromKey(SDLK_i);
-		keymap[0x2f]		= SDL_GetScancodeFromKey(SDLK_o);
-		keymap[0x30]		= SDL_GetScancodeFromKey(SDLK_p);
-		keymap[0x31]		= SDL_GetScancodeFromKey(SDLK_LEFTBRACKET);
-		keymap[0x32]		= SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET);
-		keymap[0x33]		= SDL_GetScancodeFromKey(SDLK_BACKSLASH);
-		keymap[0x34]		= SDL_GetScancodeFromKey(SDLK_DELETE);
-		keymap[0x35]		= SDL_GetScancodeFromKey(SDLK_END);
-		keymap[0x36]		= SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
-		keymap[0x37]		= SDL_GetScancodeFromKey(SDLK_KP_7);
-		keymap[0x38]		= SDL_GetScancodeFromKey(SDLK_KP_8);
-		keymap[0x39]		= SDL_GetScancodeFromKey(SDLK_KP_9);
-		keymap[0x3a]		= SDL_GetScancodeFromKey(SDLK_KP_PLUS);
-		keymap[0x3b]		= SDL_GetScancodeFromKey(SDLK_CAPSLOCK);
-		keymap[0x3c]		= SDL_GetScancodeFromKey(SDLK_a);
-		keymap[0x3d]		= SDL_GetScancodeFromKey(SDLK_s);
-		keymap[0x3e]		= SDL_GetScancodeFromKey(SDLK_d);
-		keymap[0x3f]		= SDL_GetScancodeFromKey(SDLK_f);
-		keymap[0x40]		= SDL_GetScancodeFromKey(SDLK_g);
-		keymap[0x41]		= SDL_GetScancodeFromKey(SDLK_h);
-		keymap[0x42]		= SDL_GetScancodeFromKey(SDLK_j);
-		keymap[0x43]		= SDL_GetScancodeFromKey(SDLK_k);
-		keymap[0x44]		= SDL_GetScancodeFromKey(SDLK_l);
-		keymap[0x45]		= SDL_GetScancodeFromKey(SDLK_SEMICOLON);
-		keymap[0x46]		= SDL_GetScancodeFromKey(SDLK_QUOTE);
-		keymap[0x47]		= SDL_GetScancodeFromKey(SDLK_RETURN);
-		keymap[0x48]		= SDL_GetScancodeFromKey(SDLK_KP_4);
-		keymap[0x49]		= SDL_GetScancodeFromKey(SDLK_KP_5);
-		keymap[0x4a]		= SDL_GetScancodeFromKey(SDLK_KP_6);
-		keymap[0x4b]		= SDL_GetScancodeFromKey(SDLK_LSHIFT);
-		keymap[0x4c]		= SDL_GetScancodeFromKey(SDLK_z);
-		keymap[0x4d]		= SDL_GetScancodeFromKey(SDLK_x);
-		keymap[0x4e]		= SDL_GetScancodeFromKey(SDLK_c);
-		keymap[0x4f]		= SDL_GetScancodeFromKey(SDLK_v);
-		keymap[0x50]		= SDL_GetScancodeFromKey(SDLK_b);
-		keymap[0x51]		= SDL_GetScancodeFromKey(SDLK_n);
-		keymap[0x52]		= SDL_GetScancodeFromKey(SDLK_m);
-		keymap[0x53]		= SDL_GetScancodeFromKey(SDLK_COMMA);
-		keymap[0x54]		= SDL_GetScancodeFromKey(SDLK_PERIOD);
-		keymap[0x55]		= SDL_GetScancodeFromKey(SDLK_SLASH);
-		keymap[0x56]		= SDL_GetScancodeFromKey(SDLK_RSHIFT);
-		keymap[0x57]		= SDL_GetScancodeFromKey(SDLK_UP);
-		keymap[0x58]		= SDL_GetScancodeFromKey(SDLK_KP_1);
-		keymap[0x59]		= SDL_GetScancodeFromKey(SDLK_KP_2);
-		keymap[0x5a]		= SDL_GetScancodeFromKey(SDLK_KP_3);
-		keymap[0x5b]		= SDL_GetScancodeFromKey(SDLK_KP_ENTER);
-		keymap[0x5c]		= SDL_GetScancodeFromKey(SDLK_LCTRL);
-		keymap[0x5d]		= SDL_GetScancodeFromKey(SDLK_LALT);
-		keymap[0x5e]		= SDL_GetScancodeFromKey(SDLK_SPACE);
-		keymap[0x5f]		= SDL_GetScancodeFromKey(SDLK_RALT);
-		keymap[0x60]		= SDL_GetScancodeFromKey(SDLK_RCTRL);
-		keymap[0x61]		= SDL_GetScancodeFromKey(SDLK_LEFT);
-		keymap[0x62]		= SDL_GetScancodeFromKey(SDLK_DOWN);
-		keymap[0x63]		= SDL_GetScancodeFromKey(SDLK_RIGHT);
-		keymap[0x64]		= SDL_GetScancodeFromKey(SDLK_KP_0);
-		keymap[0x65]		= SDL_GetScancodeFromKey(SDLK_KP_PERIOD);
-		keymap[0x66]		= SDL_GetScancodeFromKey(SDLK_LGUI);
-		keymap[0x67]		= SDL_GetScancodeFromKey(SDLK_RGUI);
-		keymap[0x68]		= SDL_GetScancodeFromKey(SDLK_MENU);
-		keymap[0x69]		= SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
-		keymap[0x6a]		= SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
-		keymap[0x6b]		= SDL_GetScancodeFromKey(SDLK_POWER);
+        for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
+            keymap[i] = SDL_SCANCODE_UNKNOWN;
+        }
+
+        for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
+            keystate[i] = SDL_RELEASED;
+        }
+
+        keymap[0x01]        = SDL_GetScancodeFromKey(SDLK_ESCAPE);
+        keymap[B_F1_KEY]    = SDL_GetScancodeFromKey(SDLK_F1);
+        keymap[B_F2_KEY]    = SDL_GetScancodeFromKey(SDLK_F2);
+        keymap[B_F3_KEY]    = SDL_GetScancodeFromKey(SDLK_F3);
+        keymap[B_F4_KEY]    = SDL_GetScancodeFromKey(SDLK_F4);
+        keymap[B_F5_KEY]    = SDL_GetScancodeFromKey(SDLK_F5);
+        keymap[B_F6_KEY]    = SDL_GetScancodeFromKey(SDLK_F6);
+        keymap[B_F7_KEY]    = SDL_GetScancodeFromKey(SDLK_F7);
+        keymap[B_F8_KEY]    = SDL_GetScancodeFromKey(SDLK_F8);
+        keymap[B_F9_KEY]    = SDL_GetScancodeFromKey(SDLK_F9);
+        keymap[B_F10_KEY]    = SDL_GetScancodeFromKey(SDLK_F10);
+        keymap[B_F11_KEY]    = SDL_GetScancodeFromKey(SDLK_F11);
+        keymap[B_F12_KEY]    = SDL_GetScancodeFromKey(SDLK_F12);
+        keymap[B_PRINT_KEY]    = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN);
+        keymap[B_SCROLL_KEY]    = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK);
+        keymap[B_PAUSE_KEY]    = SDL_GetScancodeFromKey(SDLK_PAUSE);
+        keymap[0x11]        = SDL_GetScancodeFromKey(SDLK_BACKQUOTE);
+        keymap[0x12]        = SDL_GetScancodeFromKey(SDLK_1);
+        keymap[0x13]        = SDL_GetScancodeFromKey(SDLK_2);
+        keymap[0x14]        = SDL_GetScancodeFromKey(SDLK_3);
+        keymap[0x15]        = SDL_GetScancodeFromKey(SDLK_4);
+        keymap[0x16]        = SDL_GetScancodeFromKey(SDLK_5);
+        keymap[0x17]        = SDL_GetScancodeFromKey(SDLK_6);
+        keymap[0x18]        = SDL_GetScancodeFromKey(SDLK_7);
+        keymap[0x19]        = SDL_GetScancodeFromKey(SDLK_8);
+        keymap[0x1a]        = SDL_GetScancodeFromKey(SDLK_9);
+        keymap[0x1b]        = SDL_GetScancodeFromKey(SDLK_0);
+        keymap[0x1c]        = SDL_GetScancodeFromKey(SDLK_MINUS);
+        keymap[0x1d]        = SDL_GetScancodeFromKey(SDLK_EQUALS);
+        keymap[0x1e]        = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
+        keymap[0x1f]        = SDL_GetScancodeFromKey(SDLK_INSERT);
+        keymap[0x20]        = SDL_GetScancodeFromKey(SDLK_HOME);
+        keymap[0x21]        = SDL_GetScancodeFromKey(SDLK_PAGEUP);
+        keymap[0x22]        = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR);
+        keymap[0x23]        = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE);
+        keymap[0x24]        = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY);
+        keymap[0x25]        = SDL_GetScancodeFromKey(SDLK_KP_MINUS);
+        keymap[0x26]        = SDL_GetScancodeFromKey(SDLK_TAB);
+        keymap[0x27]        = SDL_GetScancodeFromKey(SDLK_q);
+        keymap[0x28]        = SDL_GetScancodeFromKey(SDLK_w);
+        keymap[0x29]        = SDL_GetScancodeFromKey(SDLK_e);
+        keymap[0x2a]        = SDL_GetScancodeFromKey(SDLK_r);
+        keymap[0x2b]        = SDL_GetScancodeFromKey(SDLK_t);
+        keymap[0x2c]        = SDL_GetScancodeFromKey(SDLK_y);
+        keymap[0x2d]        = SDL_GetScancodeFromKey(SDLK_u);
+        keymap[0x2e]        = SDL_GetScancodeFromKey(SDLK_i);
+        keymap[0x2f]        = SDL_GetScancodeFromKey(SDLK_o);
+        keymap[0x30]        = SDL_GetScancodeFromKey(SDLK_p);
+        keymap[0x31]        = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET);
+        keymap[0x32]        = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET);
+        keymap[0x33]        = SDL_GetScancodeFromKey(SDLK_BACKSLASH);
+        keymap[0x34]        = SDL_GetScancodeFromKey(SDLK_DELETE);
+        keymap[0x35]        = SDL_GetScancodeFromKey(SDLK_END);
+        keymap[0x36]        = SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
+        keymap[0x37]        = SDL_GetScancodeFromKey(SDLK_KP_7);
+        keymap[0x38]        = SDL_GetScancodeFromKey(SDLK_KP_8);
+        keymap[0x39]        = SDL_GetScancodeFromKey(SDLK_KP_9);
+        keymap[0x3a]        = SDL_GetScancodeFromKey(SDLK_KP_PLUS);
+        keymap[0x3b]        = SDL_GetScancodeFromKey(SDLK_CAPSLOCK);
+        keymap[0x3c]        = SDL_GetScancodeFromKey(SDLK_a);
+        keymap[0x3d]        = SDL_GetScancodeFromKey(SDLK_s);
+        keymap[0x3e]        = SDL_GetScancodeFromKey(SDLK_d);
+        keymap[0x3f]        = SDL_GetScancodeFromKey(SDLK_f);
+        keymap[0x40]        = SDL_GetScancodeFromKey(SDLK_g);
+        keymap[0x41]        = SDL_GetScancodeFromKey(SDLK_h);
+        keymap[0x42]        = SDL_GetScancodeFromKey(SDLK_j);
+        keymap[0x43]        = SDL_GetScancodeFromKey(SDLK_k);
+        keymap[0x44]        = SDL_GetScancodeFromKey(SDLK_l);
+        keymap[0x45]        = SDL_GetScancodeFromKey(SDLK_SEMICOLON);
+        keymap[0x46]        = SDL_GetScancodeFromKey(SDLK_QUOTE);
+        keymap[0x47]        = SDL_GetScancodeFromKey(SDLK_RETURN);
+        keymap[0x48]        = SDL_GetScancodeFromKey(SDLK_KP_4);
+        keymap[0x49]        = SDL_GetScancodeFromKey(SDLK_KP_5);
+        keymap[0x4a]        = SDL_GetScancodeFromKey(SDLK_KP_6);
+        keymap[0x4b]        = SDL_GetScancodeFromKey(SDLK_LSHIFT);
+        keymap[0x4c]        = SDL_GetScancodeFromKey(SDLK_z);
+        keymap[0x4d]        = SDL_GetScancodeFromKey(SDLK_x);
+        keymap[0x4e]        = SDL_GetScancodeFromKey(SDLK_c);
+        keymap[0x4f]        = SDL_GetScancodeFromKey(SDLK_v);
+        keymap[0x50]        = SDL_GetScancodeFromKey(SDLK_b);
+        keymap[0x51]        = SDL_GetScancodeFromKey(SDLK_n);
+        keymap[0x52]        = SDL_GetScancodeFromKey(SDLK_m);
+        keymap[0x53]        = SDL_GetScancodeFromKey(SDLK_COMMA);
+        keymap[0x54]        = SDL_GetScancodeFromKey(SDLK_PERIOD);
+        keymap[0x55]        = SDL_GetScancodeFromKey(SDLK_SLASH);
+        keymap[0x56]        = SDL_GetScancodeFromKey(SDLK_RSHIFT);
+        keymap[0x57]        = SDL_GetScancodeFromKey(SDLK_UP);
+        keymap[0x58]        = SDL_GetScancodeFromKey(SDLK_KP_1);
+        keymap[0x59]        = SDL_GetScancodeFromKey(SDLK_KP_2);
+        keymap[0x5a]        = SDL_GetScancodeFromKey(SDLK_KP_3);
+        keymap[0x5b]        = SDL_GetScancodeFromKey(SDLK_KP_ENTER);
+        keymap[0x5c]        = SDL_GetScancodeFromKey(SDLK_LCTRL);
+        keymap[0x5d]        = SDL_GetScancodeFromKey(SDLK_LALT);
+        keymap[0x5e]        = SDL_GetScancodeFromKey(SDLK_SPACE);
+        keymap[0x5f]        = SDL_GetScancodeFromKey(SDLK_RALT);
+        keymap[0x60]        = SDL_GetScancodeFromKey(SDLK_RCTRL);
+        keymap[0x61]        = SDL_GetScancodeFromKey(SDLK_LEFT);
+        keymap[0x62]        = SDL_GetScancodeFromKey(SDLK_DOWN);
+        keymap[0x63]        = SDL_GetScancodeFromKey(SDLK_RIGHT);
+        keymap[0x64]        = SDL_GetScancodeFromKey(SDLK_KP_0);
+        keymap[0x65]        = SDL_GetScancodeFromKey(SDLK_KP_PERIOD);
+        keymap[0x66]        = SDL_GetScancodeFromKey(SDLK_LGUI);
+        keymap[0x67]        = SDL_GetScancodeFromKey(SDLK_RGUI);
+        keymap[0x68]        = SDL_GetScancodeFromKey(SDLK_MENU);
+        keymap[0x69]        = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
+        keymap[0x6a]        = SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
+        keymap[0x6b]        = SDL_GetScancodeFromKey(SDLK_POWER);
 }
 
 SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) {
-	if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
-		return keymap[bkey];
-	} else {
-		return SDL_SCANCODE_UNKNOWN;
-	}
+    if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
+        return keymap[bkey];
+    } else {
+        return SDL_SCANCODE_UNKNOWN;
+    }
 }
 
 int8 HAIKU_GetKeyState(int32 bkey) {
-	if(bkey > 0 && bkey < KEYMAP_SIZE) {
-		return keystate[bkey];
-	} else {
-		return SDL_RELEASED;
-	}
+    if(bkey > 0 && bkey < KEYMAP_SIZE) {
+        return keystate[bkey];
+    } else {
+        return SDL_RELEASED;
+    }
 }
 
 void HAIKU_SetKeyState(int32 bkey, int8 state) {
-	if(bkey > 0 && bkey < KEYMAP_SIZE) {
-		keystate[bkey] = state;
-	}
+    if(bkey > 0 && bkey < KEYMAP_SIZE) {
+        keystate[bkey] = state;
+    }
 }
 
 #ifdef __cplusplus
diff --git a/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc
index 1d86821..9d71996 100644
--- a/src/video/haiku/SDL_bmodes.cc
+++ b/src/video/haiku/SDL_bmodes.cc
@@ -44,30 +44,30 @@ extern "C" {
 /* This wrapper is here so that the driverdata can be freed without freeing
    the display_mode structure */
 struct SDL_DisplayModeData {
-	display_mode *bmode;
+    display_mode *bmode;
 };
 #endif
 
 static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
-	return ((SDL_BWin*)(window->driverdata));
+    return ((SDL_BWin*)(window->driverdata));
 }
 
 static SDL_INLINE SDL_BApp *_GetBeApp() {
-	return ((SDL_BApp*)be_app);
+    return ((SDL_BApp*)be_app);
 }
 
 static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
 #if WRAP_BMODE
-	return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
+    return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
 #else
-	return (display_mode*)(mode->driverdata);
+    return (display_mode*)(mode->driverdata);
 #endif
 }
 
 /* Copied from haiku/trunk/src/preferences/screen/ScreenMode.cpp */
 static float get_refresh_rate(display_mode &mode) {
-	return float(mode.timing.pixel_clock * 1000)
-		/ float(mode.timing.h_total * mode.timing.v_total);
+    return float(mode.timing.pixel_clock * 1000)
+        / float(mode.timing.h_total * mode.timing.v_total);
 }
 
 
@@ -76,57 +76,57 @@ static float get_refresh_rate(display_mode &mode) {
  * This is a useful debugging tool.  Uncomment and insert into code as needed.
  */
 void _SpoutModeData(display_mode *bmode) {
-	printf("BMode:\n");
-	printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
-	printf("\th,v = (%i,%i)\n", bmode->h_display_start, 
-			bmode->v_display_start);
-	if(bmode->flags) {
-		printf("\tFlags:\n");
-		if(bmode->flags & B_SCROLL) {
-			printf("\t\tB_SCROLL\n");
-		}
-		if(bmode->flags & B_8_BIT_DAC) {
-			printf("\t\tB_8_BIT_DAC\n");
-		}
-		if(bmode->flags & B_HARDWARE_CURSOR) {
-			printf("\t\tB_HARDWARE_CURSOR\n");
-		}
-		if(bmode->flags & B_PARALLEL_ACCESS) {
-			printf("\t\tB_PARALLEL_ACCESS\n");
-		}
-		if(bmode->flags & B_DPMS) {
-			printf("\t\tB_DPMS\n");
-		}
-		if(bmode->flags & B_IO_FB_NA) {
-			printf("\t\tB_IO_FB_NA\n");
-		}
-	}
-	printf("\tTiming:\n");
-	printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
-	printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n",
-		bmode->timing.h_display, bmode->timing.h_sync_start,
-		bmode->timing.h_sync_end, bmode->timing.h_total);
-	printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
-		bmode->timing.v_display, bmode->timing.v_sync_start,
-		bmode->timing.v_sync_end, bmode->timing.v_total);
-	if(bmode->timing.flags) {
-		printf("\t\tFlags:\n");
-		if(bmode->timing.flags & B_BLANK_PEDESTAL) {
-			printf("\t\t\tB_BLANK_PEDESTAL\n");
-		}
-		if(bmode->timing.flags & B_TIMING_INTERLACED) {
-			printf("\t\t\tB_TIMING_INTERLACED\n");
-		}
-		if(bmode->timing.flags & B_POSITIVE_HSYNC) {
-			printf("\t\t\tB_POSITIVE_HSYNC\n");
-		}
-		if(bmode->timing.flags & B_POSITIVE_VSYNC) {
-			printf("\t\t\tB_POSITIVE_VSYNC\n");
-		}
-		if(bmode->timing.flags & B_SYNC_ON_GREEN) {
-			printf("\t\t\tB_SYNC_ON_GREEN\n");
-		}
-	}
+    printf("BMode:\n");
+    printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
+    printf("\th,v = (%i,%i)\n", bmode->h_display_start, 
+            bmode->v_display_start);
+    if(bmode->flags) {
+        printf("\tFlags:\n");
+        if(bmode->flags & B_SCROLL) {
+            printf("\t\tB_SCROLL\n");
+        }
+        if(bmode->flags & B_8_BIT_DAC) {
+            printf("\t\tB_8_BIT_DAC\n");
+        }
+        if(bmode->flags & B_HARDWARE_CURSOR) {
+            printf("\t\tB_HARDWARE_CURSOR\n");
+        }
+        if(bmode->flags & B_PARALLEL_ACCESS) {
+            printf("\t\tB_PARALLEL_ACCESS\n");
+        }
+        if(bmode->flags & B_DPMS) {
+            printf("\t\tB_DPMS\n");
+        }
+        if(bmode->flags & B_IO_FB_NA) {
+            printf("\t\tB_IO_FB_NA\n");
+        }
+    }
+    printf("\tTiming:\n");
+    printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
+    printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n",
+        bmode->timing.h_display, bmode->timing.h_sync_start,
+        bmode->timing.h_sync_end, bmode->timing.h_total);
+    printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
+        bmode->timing.v_display, bmode->timing.v_sync_start,
+        bmode->timing.v_sync_end, bmode->timing.v_total);
+    if(bmode->timing.flags) {
+        printf("\t\tFlags:\n");
+        if(bmode->timing.flags & B_BLANK_PEDESTAL) {
+            printf("\t\t\tB_BLANK_PEDESTAL\n");
+        }
+        if(bmode->timing.flags & B_TIMING_INTERLACED) {
+            printf("\t\t\tB_TIMING_INTERLACED\n");
+        }
+        if(bmode->timing.flags & B_POSITIVE_HSYNC) {
+            printf("\t\t\tB_POSITIVE_HSYNC\n");
+        }
+        if(bmode->timing.flags & B_POSITIVE_VSYNC) {
+            printf("\t\t\tB_POSITIVE_VSYNC\n");
+        }
+        if(bmode->timing.flags & B_SYNC_ON_GREEN) {
+            printf("\t\t\tB_SYNC_ON_GREEN\n");
+        }
+    }
 }
 #endif
 
@@ -134,101 +134,101 @@ void _SpoutModeData(display_mode *bmode) {
 
 int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace)
 {
-	int bitsperpixel;
-
-	bitsperpixel = 0;
-	switch (colorspace) {
-	    case B_CMAP8:
-		bitsperpixel = 8;
-		break;
-	    case B_RGB15:
-	    case B_RGBA15:
-	    case B_RGB15_BIG:
-	    case B_RGBA15_BIG:
-		bitsperpixel = 15;
-		break;
-	    case B_RGB16:
-	    case B_RGB16_BIG:
-		bitsperpixel = 16;
-		break;
-	    case B_RGB32:
-	    case B_RGBA32:
-	    case B_RGB32_BIG:
-	    case B_RGBA32_BIG:
-		bitsperpixel = 32;
-		break;
-	    default:
-		break;
-	}
-	return(bitsperpixel);
+    int bitsperpixel;
+
+    bitsperpixel = 0;
+    switch (colorspace) {
+        case B_CMAP8:
+        bitsperpixel = 8;
+        break;
+        case B_RGB15:
+        case B_RGBA15:
+        case B_RGB15_BIG:
+        case B_RGBA15_BIG:
+        bitsperpixel = 15;
+        break;
+        case B_RGB16:
+        case B_RGB16_BIG:
+        bitsperpixel = 16;
+        break;
+        case B_RGB32:
+        case B_RGBA32:
+        case B_RGB32_BIG:
+        case B_RGBA32_BIG:
+        bitsperpixel = 32;
+        break;
+        default:
+        break;
+    }
+    return(bitsperpixel);
 }
 
 int32 HAIKU_BPPToSDLPxFormat(int32 bpp) {
-	/* Translation taken from SDL_windowsmodes.c */
-	switch (bpp) {
-	case 32:
-		return SDL_PIXELFORMAT_RGB888;
-		break;
-	case 24:	/* May not be supported by Haiku */
-		return SDL_PIXELFORMAT_RGB24;
-		break;
-	case 16:
-		return SDL_PIXELFORMAT_RGB565;
-		break;
-	case 15:
-		return SDL_PIXELFORMAT_RGB555;
-		break;
-	case 8:
-		return SDL_PIXELFORMAT_INDEX8;
-		break;
-	case 4:		/* May not be supported by Haiku */
-		return SDL_PIXELFORMAT_INDEX4LSB;
-		break;
-	}
-
-	/* May never get here, but safer and needed to shut up compiler */
-	SDL_SetError("Invalid bpp value");
-	return 0;       
+    /* Translation taken from SDL_windowsmodes.c */
+    switch (bpp) {
+    case 32:
+        return SDL_PIXELFORMAT_RGB888;
+        break;
+    case 24:    /* May not be supported by Haiku */
+        return SDL_PIXELFORMAT_RGB24;
+        break;
+    case 16:
+        return SDL_PIXELFORMAT_RGB565;
+        break;
+    case 15:
+        return SDL_PIXELFORMAT_RGB555;
+        break;
+    case 8:
+        return SDL_PIXELFORMAT_INDEX8;
+        break;
+    case 4:        /* May not be supported by Haiku */
+        return SDL_PIXELFORMAT_INDEX4LSB;
+        break;
+    }
+
+    /* May never get here, but safer and needed to shut up compiler */
+    SDL_SetError("Invalid bpp value");
+    return 0;       
 }
 
 static void _BDisplayModeToSdlDisplayMode(display_mode *bmode,
-		SDL_DisplayMode *mode) {
-	mode->w = bmode->virtual_width;
-	mode->h = bmode->virtual_height;
-	mode->refresh_rate = (int)get_refresh_rate(*bmode);
+        SDL_DisplayMode *mode) {
+    mode->w = bmode->virtual_width;
+    mode->h = bmode->virtual_height;
+    mode->refresh_rate = (int)get_refresh_rate(*bmode);
 
 #if WRAP_BMODE
-	SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
-		sizeof(SDL_DisplayModeData));
-	data->bmode = bmode;
-	
-	mode->driverdata = data;
+    SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
+        sizeof(SDL_DisplayModeData));
+    data->bmode = bmode;
+    
+    mode->driverdata = data;
 
 #else
 
-	mode->driverdata = bmode;
+    mode->driverdata = bmode;
 #endif
 
-	/* Set the format */
-	int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space);
-	mode->format = HAIKU_BPPToSDLPxFormat(bpp);
+    /* Set the format */
+    int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space);
+    mode->format = HAIKU_BPPToSDLPxFormat(bpp);
 }
 
 /* Later, there may be more than one monitor available */
 static void _AddDisplay(BScreen *screen) {
-	SDL_VideoDisplay display;
-	SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1,
-		sizeof(SDL_DisplayMode));
-	display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode));
-	screen->GetMode(bmode);
-
-	_BDisplayModeToSdlDisplayMode(bmode, mode);
-	
-	SDL_zero(display);
-	display.desktop_mode = *mode;
-	display.current_mode = *mode;
-	
-	SDL_AddVideoDisplay(&display);
+    SDL_VideoDisplay display;
+    SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1,
+        sizeof(SDL_DisplayMode));
+    display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode));
+    screen->GetMode(bmode);
+
+    _BDisplayModeToSdlDisplayMode(bmode, mode);
+    
+    SDL_zero(display);
+    display.desktop_mode = *mode;
+    display.current_mode = *mode;
+    
+    SDL_AddVideoDisplay(&display);
 }
 
 /*
@@ -236,92 +236,92 @@ static void _AddDisplay(BScreen *screen) {
  */
 
 int HAIKU_InitModes(_THIS) {
-	BScreen screen;
+    BScreen screen;
 
-	/* TODO: When Haiku supports multiple display screens, call
-	   _AddDisplayScreen() for each of them. */
-	_AddDisplay(&screen);
-	return 0;
+    /* TODO: When Haiku supports multiple display screens, call
+       _AddDisplayScreen() for each of them. */
+    _AddDisplay(&screen);
+    return 0;
 }
 
 int HAIKU_QuitModes(_THIS) {
-	/* FIXME: Nothing really needs to be done here at the moment? */
-	return 0;
+    /* FIXME: Nothing really needs to be done here at the moment? */
+    return 0;
 }
 
 
 int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
-	BScreen bscreen;
-	BRect rc = bscreen.Frame();
-	rect->x = (int)rc.left;
-	rect->y = (int)rc.top;
-	rect->w = (int)rc.Width() + 1;
-	rect->h = (int)rc.Height() + 1;
-	return 0;
+    BScreen bscreen;
+    BRect rc = bscreen.Frame();
+    rect->x = (int)rc.left;
+    rect->y = (int)rc.top;
+    rect->w = (int)rc.Width() + 1;
+    rect->h = (int)rc.Height() + 1;
+    return 0;
 }
 
 void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
-	/* Get the current screen */
-	BScreen bscreen;
-
-	/* Iterate through all of the modes */
-	SDL_DisplayMode mode;
-	display_mode this_bmode;
-	display_mode *bmodes;
-	uint32 count, i;
-	
-	/* Get graphics-hardware supported modes */
-	bscreen.GetModeList(&bmodes, &count);
-	bscreen.GetMode(&this_bmode);
-	
-	for(i = 0; i < count; ++i) {
-		// FIXME: Apparently there are errors with colorspace changes
-		if (bmodes[i].space == this_bmode.space) {
-			_BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
-			SDL_AddDisplayMode(display, &mode);
-		}
-	}
-	free(bmodes);
+    /* Get the current screen */
+    BScreen bscreen;
+
+    /* Iterate through all of the modes */
+    SDL_DisplayMode mode;
+    display_mode this_bmode;
+    display_mode *bmodes;
+    uint32 count, i;
+    
+    /* Get graphics-hardware supported modes */
+    bscreen.GetModeList(&bmodes, &count);
+    bscreen.GetMode(&this_bmode);
+    
+    for(i = 0; i < count; ++i) {
+        // FIXME: Apparently there are errors with colorspace changes
+        if (bmodes[i].space == this_bmode.space) {
+            _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
+            SDL_AddDisplayMode(display, &mode);
+        }
+    }
+    free(bmodes);
 }
 
 
 int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
-	/* Get the current screen */
-	BScreen bscreen;
-	if(!bscreen.IsValid()) {
-		printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
-	}
-
-	/* Set the mode using the driver data */
-	display_mode *bmode = _ExtractBMode(mode);
-
-
-	/* FIXME: Is the first option always going to be the right one? */
-	uint32 c = 0, i;
-	display_mode *bmode_list;
-	bscreen.GetModeList(&bmode_list, &c);
-	for(i = 0; i < c; ++i) {
-		if(	bmode_list[i].space == bmode->space &&
-			bmode_list[i].virtual_width == bmode->virtual_width &&
-			bmode_list[i].virtual_height == bmode->virtual_height ) {
-				bmode = &bmode_list[i];
-				break;
-		}
-	}
-
-	if(bscreen.SetMode(bmode) != B_OK) {
-		return SDL_SetError("Bad video mode");
-	}
-	
-	free(bmode_list);
-	
+    /* Get the current screen */
+    BScreen bscreen;
+    if(!bscreen.IsValid()) {
+        printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
+    }
+
+    /* Set the mode using the driver data */
+    display_mode *bmode = _ExtractBMode(mode);
+
+
+    /* FIXME: Is the first option always going to be the right one? */
+    uint32 c = 0, i;
+    display_mode *bmode_list;
+    bscreen.GetModeList(&bmode_list, &c);
+    for(i = 0; i < c; ++i) {
+        if(    bmode_list[i].space == bmode->space &&
+            bmode_list[i].virtual_width == bmode->virtual_width &&
+            bmode_list[i].virtual_height == bmode->virtual_height ) {
+                bmode = &bmode_list[i];
+                break;
+        }
+    }
+
+    if(bscreen.SetMode(bmode) != B_OK) {
+        return SDL_SetError("Bad video mode");
+    }
+    
+    free(bmode_list);
+    
 #if SDL_VIDEO_OPENGL
-	/* FIXME: Is there some way to reboot the OpenGL context?  This doesn't
-	   help */
-//	HAIKU_GL_RebootContexts(_this);
+    /* FIXME: Is there some way to reboot the OpenGL context?  This doesn't
+       help */
+//    HAIKU_GL_RebootContexts(_this);
 #endif
 
-	return 0;
+    return 0;
 }
 
 #ifdef __cplusplus
diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc
index e6a9736..e7b4b6e 100644
--- a/src/video/haiku/SDL_bvideo.cc
+++ b/src/video/haiku/SDL_bvideo.cc
@@ -56,7 +56,7 @@ HAIKU_CreateDevice(int devindex)
     device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
 
     device->driverdata = NULL; /* FIXME: Is this the cause of some of the
-    							  SDL_Quit() errors? */
+                                  SDL_Quit() errors? */
 
 /* TODO: Figure out if any initialization needs to go here */
 
@@ -122,37 +122,36 @@ HAIKU_CreateDevice(int devindex)
 }
 
 VideoBootStrap HAIKU_bootstrap = {
-	"haiku", "Haiku graphics",
-	HAIKU_Available, HAIKU_CreateDevice
+    "haiku", "Haiku graphics",
+    HAIKU_Available, HAIKU_CreateDevice
 };
 
 void HAIKU_DeleteDevice(SDL_VideoDevice * device)
 {
-	SDL_free(device->driverdata);
-	SDL_free(device);
+    SDL_free(device->driverdata);
+    SDL_free(device);
 }
 
 int HAIKU_VideoInit(_THIS)
 {
-	/* Initialize the Be Application for appserver interaction */
-	if (SDL_InitBeApp() < 0) {
-		return -1;
-	}
-	
-	/* Initialize video modes */
-	HAIKU_InitModes(_this);
-
-	/* Init the keymap */
-	HAIKU_InitOSKeymap();
-	
-	
+    /* Initialize the Be Application for appserver interaction */
+    if (SDL_InitBeApp() < 0) {
+        return -1;
+    }
+    
+    /* Initialize video modes */
+    HAIKU_InitModes(_this);
+
+    /* Init the keymap */
+    HAIKU_InitOSKeymap();
+
 #if SDL_VIDEO_OPENGL
         /* testgl application doesn't load library, just tries to load symbols */
         /* is it correct? if so we have to load library here */
     HAIKU_GL_LoadLibrary(_this, NULL);
 #endif
 
-        /* We're done! */
+    /* We're done! */
     return (0);
 }
 
diff --git a/src/video/haiku/SDL_bwindow.cc b/src/video/haiku/SDL_bwindow.cc
index e89be1e..142a3fa 100644
--- a/src/video/haiku/SDL_bwindow.cc
+++ b/src/video/haiku/SDL_bwindow.cc
@@ -32,36 +32,36 @@ extern "C" {
 #endif
 
 static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
-	return ((SDL_BWin*)(window->driverdata));
+    return ((SDL_BWin*)(window->driverdata));
 }
 
 static SDL_INLINE SDL_BApp *_GetBeApp() {
-	return ((SDL_BApp*)be_app);
+    return ((SDL_BApp*)be_app);
 }
 
 static int _InitWindow(_THIS, SDL_Window *window) {
-	uint32 flags = 0;
-	window_look look = B_TITLED_WINDOW_LOOK;
+    uint32 flags = 0;
+    window_look look = B_TITLED_WINDOW_LOOK;
 
-	BRect bounds(
+    BRect bounds(
         window->x,
         window->y,
-        window->x + window->w - 1,	//BeWindows have an off-by-one px w/h thing
+        window->x + window->w - 1,    //BeWindows have an off-by-one px w/h thing
         window->y + window->h - 1
     );
     
     if(window->flags & SDL_WINDOW_FULLSCREEN) {
-    	/* TODO: Add support for this flag */
-    	printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
+        /* TODO: Add support for this flag */
+        printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
     }
     if(window->flags & SDL_WINDOW_OPENGL) {
-    	/* TODO: Add support for this flag */
+        /* TODO: Add support for this flag */
     }
     if(!(window->flags & SDL_WINDOW_RESIZABLE)) {
-    	flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
+        flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
     }
     if(window->flags & SDL_WINDOW_BORDERLESS) {
-    	look = B_NO_BORDER_WINDOW_LOOK;
+        look = B_NO_BORDER_WINDOW_LOOK;
     }
 
     SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags);
@@ -79,35 +79,35 @@ int HAIKU_CreateWindow(_THIS, SDL_Window *window) {
     if (_InitWindow(_this, window) < 0) {
         return -1;
     }
-	
-	/* Start window loop */
+    
+    /* Start window loop */
     _ToBeWin(window)->Show();
     return 0;
 }
 
 int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
 
-	SDL_BWin *otherBWin = (SDL_BWin*)data;
-	if(!otherBWin->LockLooper())
-		return -1;
-	
-	/* Create the new window and initialize its members */
-	window->x = (int)otherBWin->Frame().left;
-	window->y = (int)otherBWin->Frame().top;
-	window->w = (int)otherBWin->Frame().Width();
-	window->h = (int)otherBWin->Frame().Height();
-	
-	/* Set SDL flags */
-	if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
-		window->flags |= SDL_WINDOW_RESIZABLE;
-	}
-	
-	/* If we are out of memory, return the error code */
+    SDL_BWin *otherBWin = (SDL_BWin*)data;
+    if(!otherBWin->LockLooper())
+        return -1;
+    
+    /* Create the new window and initialize its members */
+    window->x = (int)otherBWin->Frame().left;
+    window->y = (int)otherBWin->Frame().top;
+    window->w = (int)otherBWin->Frame().Width();
+    window->h = (int)otherBWin->Frame().Height();
+    
+    /* Set SDL flags */
+    if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
+        window->flags |= SDL_WINDOW_RESIZABLE;
+    }
+    
+    /* If we are out of memory, return the error code */
     if (_InitWindow(_this, window) < 0) {
         return -1;
     }
-	
-	/* TODO: Add any other SDL-supported window attributes here */
+    
+    /* TODO: Add any other SDL-supported window attributes here */
     _ToBeWin(window)->SetTitle(otherBWin->Title());
     
     /* Start window loop and unlock the other window */
@@ -118,106 +118,106 @@ int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
 }
 
 void HAIKU_SetWindowTitle(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_SET_TITLE);
-	msg.AddString("window-title", window->title);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_SET_TITLE);
+    msg.AddString("window-title", window->title);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
-	/* FIXME: Icons not supported by Haiku */
+    /* FIXME: Icons not supported by Haiku */
 }
 
 void HAIKU_SetWindowPosition(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_MOVE_WINDOW);
-	msg.AddInt32("window-x", window->x);
-	msg.AddInt32("window-y", window->y);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_MOVE_WINDOW);
+    msg.AddInt32("window-x", window->x);
+    msg.AddInt32("window-y", window->y);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_SetWindowSize(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_RESIZE_WINDOW);
-	msg.AddInt32("window-w", window->w - 1);
-	msg.AddInt32("window-h", window->h - 1);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_RESIZE_WINDOW);
+    msg.AddInt32("window-w", window->w - 1);
+    msg.AddInt32("window-h", window->h - 1);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
-	BMessage msg(BWIN_SET_BORDERED);
-	msg.AddBool("window-border", bordered != SDL_FALSE);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_SET_BORDERED);
+    msg.AddBool("window-border", bordered != SDL_FALSE);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
-	BMessage msg(BWIN_SET_RESIZABLE);
-	msg.AddBool("window-resizable", resizable != SDL_FALSE);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_SET_RESIZABLE);
+    msg.AddBool("window-resizable", resizable != SDL_FALSE);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_ShowWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_SHOW_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_SHOW_WINDOW);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_HideWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_HIDE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_HIDE_WINDOW);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_RaiseWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_SHOW_WINDOW);	/* Activate this window and move to front */
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_SHOW_WINDOW);    /* Activate this window and move to front */
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_MAXIMIZE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_MAXIMIZE_WINDOW);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_MINIMIZE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_MINIMIZE_WINDOW);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_RestoreWindow(_THIS, SDL_Window * window) {
-	BMessage msg(BWIN_RESTORE_WINDOW);
-	_ToBeWin(window)->PostMessage(&msg);
+    BMessage msg(BWIN_RESTORE_WINDOW);
+    _ToBeWin(window)->PostMessage(&msg);
 }
 
 void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window,
-		SDL_VideoDisplay * display, SDL_bool fullscreen) {
-	/* Haiku tracks all video display information */
-	BMessage msg(BWIN_FULLSCREEN);
-	msg.AddBool("fullscreen", fullscreen);
-	_ToBeWin(window)->PostMessage(&msg);
-	
+        SDL_VideoDisplay * display, SDL_bool fullscreen) {
+    /* Haiku tracks all video display information */
+    BMessage msg(BWIN_FULLSCREEN);
+    msg.AddBool("fullscreen", fullscreen);
+    _ToBeWin(window)->PostMessage(&msg);
+    
 }
 
 int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
-	/* FIXME: Not Haiku supported */
-	return -1;
+    /* FIXME: Not Haiku supported */
+    return -1;
 }
 
 int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
-	/* FIXME: Not Haiku supported */
-	return -1;
+    /* FIXME: Not Haiku supported */
+    return -1;
 }
 
 
 void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
-	/* TODO: Implement this! */
+    /* TODO: Implement this! */
 }
 
 void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
-	_ToBeWin(window)->LockLooper();	/* This MUST be locked */
-	_GetBeApp()->ClearID(_ToBeWin(window));
-	_ToBeWin(window)->Quit();
-	window->driverdata = NULL;
+    _ToBeWin(window)->LockLooper();    /* This MUST be locked */
+    _GetBeApp()->ClearID(_ToBeWin(window));
+    _ToBeWin(window)->Quit();
+    window->driverdata = NULL;
 }
 
 SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window,
                                     struct SDL_SysWMinfo *info) {
-	/* FIXME: What is the point of this? What information should be included? */
-	return SDL_FALSE;
+    /* FIXME: What is the point of this? What information should be included? */
+    return SDL_FALSE;
 }
 
 
diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c
index e23dd13..0474089 100644
--- a/src/video/kmsdrm/SDL_kmsdrmmouse.c
+++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c
@@ -487,12 +487,12 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
        That's why we move the cursor graphic ONLY. */
     if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
         curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
-	drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
-	ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y);
+        drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
+        ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y);
 
-	if (ret) {
-	    SDL_SetError("drmModeMoveCursor() failed.");
-	}
+        if (ret) {
+            SDL_SetError("drmModeMoveCursor() failed.");
+        }
     }
 }
 
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
index 7a0b079..7e8fae7 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -50,23 +50,23 @@ KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) {
     KMSDRM_FBInfo *fb_info;
 
     if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
-	SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup");
-	return SDL_FALSE;
+        SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup");
+        return SDL_FALSE;
     }
 
     wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
     if (wdata->next_bo == NULL) {
-	SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
-	return SDL_FALSE;
+        SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
+        return SDL_FALSE;
     }
 
     fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo);
     if (fb_info == NULL) {
-	return SDL_FALSE;
+        return SDL_FALSE;
     }
 
     if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id,
-			    0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) {
+                            0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) {
        SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC to a GBM buffer");
        return SDL_FALSE;
 
@@ -153,14 +153,14 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
     } else {
         /* Queue page flip at vsync */
 
-	/* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not,
+        /* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not,
            or FlipPage won't work in some cases. */
-	if (!wdata->crtc_ready) {
+        if (!wdata->crtc_ready) {
             if(!KMSDRM_GLES_SetupCrtc(_this, window)) {
                 SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips");
                 return 0;
             }
-	}
+        }
 
         /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModePageFlip(%d, %u, %u, DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip)",
             vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id); */
diff --git a/src/video/raspberry/SDL_rpivideo.c b/src/video/raspberry/SDL_rpivideo.c
index e386380..c4f4a60 100644
--- a/src/video/raspberry/SDL_rpivideo.c
+++ b/src/video/raspberry/SDL_rpivideo.c
@@ -343,17 +343,17 @@ RPI_DestroyWindow(_THIS, SDL_Window * window)
     SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
 
     if(data) {
-	if (data->double_buffer) {
-	    /* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
-	    SDL_LockMutex(data->vsync_cond_mutex);
-	    SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
-	    SDL_UnlockMutex(data->vsync_cond_mutex);
+        if (data->double_buffer) {
+            /* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
+            SDL_LockMutex(data->vsync_cond_mutex);
+            SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
+            SDL_UnlockMutex(data->vsync_cond_mutex);
 
-	    vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
+            vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
 
-	    SDL_DestroyCond(data->vsync_cond);
-	    SDL_DestroyMutex(data->vsync_cond_mutex);
-	}
+            SDL_DestroyCond(data->vsync_cond);
+            SDL_DestroyMutex(data->vsync_cond_mutex);
+        }
 
 #if SDL_VIDEO_OPENGL_EGL
         if (data->egl_surface != EGL_NO_SURFACE) {
diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m
index e8ecebe..15762d2 100644
--- a/src/video/uikit/SDL_uikitappdelegate.m
+++ b/src/video/uikit/SDL_uikitappdelegate.m
@@ -445,7 +445,7 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
 #if !TARGET_OS_TV
 - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation
 {
-	SDL_OnApplicationDidChangeStatusBarOrientation();
+    SDL_OnApplicationDidChangeStatusBarOrientation();
 }
 #endif
 
diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m
index acf739b..7ddf107 100644
--- a/src/video/uikit/SDL_uikitmodes.m
+++ b/src/video/uikit/SDL_uikitmodes.m
@@ -191,7 +191,7 @@ UIKit_InitModes(_THIS)
             }
         }
 #if !TARGET_OS_TV
-		SDL_OnApplicationDidChangeStatusBarOrientation();
+        SDL_OnApplicationDidChangeStatusBarOrientation();
 #endif
     }
 
diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m
index bd60c55..caabfac 100644
--- a/src/video/uikit/SDL_uikitview.m
+++ b/src/video/uikit/SDL_uikitview.m
@@ -252,34 +252,34 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
 
 - (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
 {
-	if (!SDL_AppleTVRemoteOpenedAsJoystick) {
-    	for (UIPress *press in presses) {
-        	SDL_Scancode scancode = [self scancodeFromPressType:press.type];
-        	SDL_SendKeyboardKey(SDL_PRESSED, scancode);
-    	}
-	}
+    if (!SDL_AppleTVRemoteOpenedAsJoystick) {
+        for (UIPress *press in presses) {
+            SDL_Scancode scancode = [self scancodeFromPressType:press.type];
+            SDL_SendKeyboardKey(SDL_PRESSED, scancode);
+        }
+    }
     [super pressesBegan:presses withEvent:event];
 }
 
 - (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
 {
-	if (!SDL_AppleTVRemoteOpenedAsJoystick) {
-		for (UIPress *press in presses) {
-			SDL_Scancode scancode = [self scancodeFromPressType:press.type];
-			SDL_SendKeyboardKey(SDL_RELEASED, scancode);
-		}
-	}
+    if (!SDL_AppleTVRemoteOpenedAsJoystick) {
+        for (UIPress *press in presses) {
+            SDL_Scancode scancode = [self scancodeFromPressType:press.type];
+            SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+        }
+    }
     [super pressesEnded:presses withEvent:event];
 }
 
 - (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
 {
-	if (!SDL_AppleTVRemoteOpenedAsJoystick) {
-		for (UIPress *press in presses) {
-			SDL_Scancode scancode = [self scancodeFromPressType:press.type];
-			SDL_SendKeyboardKey(SDL_RELEASED, scancode);
-		}
-	}
+    if (!SDL_AppleTVRemoteOpenedAsJoystick) {
+        for (UIPress *press in presses) {
+            SDL_Scancode scancode = [self scancodeFromPressType:press.type];
+            SDL_SendKeyboardKey(SDL_RELEASED, scancode);
+        }
+    }
     [super pressesCancelled:presses withEvent:event];
 }
 
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index b8be608..5ee76af 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -747,7 +747,7 @@ static const struct wl_data_offer_listener data_offer_listener = {
 
 static void
 data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device,
-			                  struct wl_data_offer *id)
+                              struct wl_data_offer *id)
 {
     SDL_WaylandDataOffer *data_offer = NULL;
 
@@ -765,7 +765,7 @@ data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device,
 
 static void
 data_device_handle_enter(void *data, struct wl_data_device *wl_data_device,
-		                 uint32_t serial, struct wl_surface *surface,
+                         uint32_t serial, struct wl_surface *surface,
                          wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id)
 {
     SDL_WaylandDataDevice *data_device = data;
@@ -808,7 +808,7 @@ data_device_handle_leave(void *data, struct wl_data_device *wl_data_device)
 
 static void
 data_device_handle_motion(void *data, struct wl_data_device *wl_data_device,
-		                  uint32_t time, wl_fixed_t x, wl_fixed_t y)
+                          uint32_t time, wl_fixed_t x, wl_fixed_t y)
 {
 }
 
@@ -847,7 +847,7 @@ data_device_handle_drop(void *data, struct wl_data_device *wl_data_device)
 
 static void
 data_device_handle_selection(void *data, struct wl_data_device *wl_data_device,
-			                 struct wl_data_offer *id)
+                             struct wl_data_offer *id)
 {    
     SDL_WaylandDataDevice *data_device = data;
     SDL_WaylandDataOffer *offer = NULL;
diff --git a/src/video/wayland/SDL_waylandtouch.c b/src/video/wayland/SDL_waylandtouch.c
index 005b47f..1cf37c1 100644
--- a/src/video/wayland/SDL_waylandtouch.c
+++ b/src/video/wayland/SDL_waylandtouch.c
@@ -89,9 +89,9 @@ touch_handle_touch(void *data,
     */
 
     SDL_TouchID deviceId = 1;
-	if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) {
-		 SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
-	}
+    if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) {
+         SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
+    }
 
     switch (touchState) {
         case QtWaylandTouchPointPressed:
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 0623027..b6155e7 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -68,10 +68,10 @@ static char *
 get_classname()
 {
 /* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec:
-	"The surface class identifies the general class of applications
-	to which the surface belongs. A common convention is to use the
-	file name (or the full path if it is a non-standard location) of
-	the application's .desktop file as the class." */
+    "The surface class identifies the general class of applications
+    to which the surface belongs. A common convention is to use the
+    file name (or the full path if it is a non-standard location) of
+    the application's .desktop file as the class." */
 
     char *spot;
 #if defined(__LINUX__) || defined(__FREEBSD__)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 7055336..aaebea9 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -134,10 +134,10 @@ static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = {
 
 static void
 handle_configure_zxdg_toplevel(void *data,
-			  struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
-			  int32_t width,
-			  int32_t height,
-			  struct wl_array *states)
+              struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
+              int32_t width,
+              int32_t height,
+              struct wl_array *states)
 {
     SDL_WindowData *wind = (SDL_WindowData *)data;
     SDL_Window *window = wind->sdlwindow;
@@ -213,10 +213,10 @@ static const struct xdg_surface_listener shell_surface_listener_xdg = {
 
 static void
 handle_configure_xdg_toplevel(void *data,
-			  struct xdg_toplevel *xdg_toplevel,
-			  int32_t width,
-			  int32_t height,
-			  struct wl_array *states)
+              struct xdg_toplevel *xdg_toplevel,
+              int32_t width,
+              int32_t height,
+              struct wl_array *states)
 {
     SDL_WindowData *wind = (SDL_WindowData *)data;
     SDL_Window *window = wind->sdlwindow;
diff --git a/src/video/windows/SDL_windowsopengl.h b/src/video/windows/SDL_windowsopengl.h
index 75b4898..8704411 100644
--- a/src/video/windows/SDL_windowsopengl.h
+++ b/src/video/windows/SDL_windowsopengl.h
@@ -33,31 +33,31 @@ struct SDL_GLDriverData
     SDL_bool HAS_WGL_ARB_create_context_robustness;
     SDL_bool HAS_WGL_ARB_create_context_no_error;
 
-	/* Max version of OpenGL ES context that can be created if the
-	   implementation supports WGL_EXT_create_context_es2_profile.
-	   major = minor = 0 when unsupported.
-	 */
-	struct {
-		int major;
-		int minor;
-	} es_profile_max_supported_version;
+    /* Max version of OpenGL ES context that can be created if the
+       implementation supports WGL_EXT_create_context_es2_profile.
+       major = minor = 0 when unsupported.
+     */
+    struct {
+        int major;
+        int minor;
+    } es_profile_max_supported_version;
 
-	void *(WINAPI * wglGetProcAddress) (const char *proc);
-      HGLRC(WINAPI * wglCreateContext) (HDC hdc);
-      BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc);
-      BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc);
-      BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
-      BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc,
-                                              const int *piAttribIList,
-                                              const FLOAT * pfAttribFList,
-                                              UINT nMaxFormats,
-                                              int *piFormats,
-                                              UINT * nNumFormats);
-      BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat,
-                                                   int iLayerPlane,
-                                                   UINT nAttributes,
-                                                   const int *piAttributes,
-                                                   int *piValues);
+    void *(WINAPI * wglGetProcAddress) (const char *proc);
+    HGLRC(WINAPI * wglCreateContext) (HDC hdc);
+    BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc);
+    BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc);
+    BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
+    BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc,
+                                            const int *piAttribIList,
+                                            const FLOAT * pfAttribFList,
+                                            UINT nMaxFormats,
+                                            int *piFormats,
+                                            UINT * nNumFormats);
+    BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat,
+                                                 int iLayerPlane,
+                                                 UINT nAttributes,
+                                                 const int *piAttributes,
+                                                 int *piValues);
     BOOL (WINAPI * wglSwapIntervalEXT) (int interval);
     int (WINAPI * wglGetSwapIntervalEXT) (void);
 };
diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c
index c4b34f0..6bb8f2a 100644
--- a/src/video/windows/SDL_windowsvulkan.c
+++ b/src/video/windows/SDL_windowsvulkan.c
@@ -40,7 +40,7 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path)
 {
     VkExtensionProperties *extensions = NULL;
     Uint32 extensionCount = 0;
-	Uint32 i;
+    Uint32 i;
     SDL_bool hasSurfaceExtension = SDL_FALSE;
     SDL_bool hasWin32SurfaceExtension = SDL_FALSE;
     PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
diff --git a/src/video/x11/SDL_x11opengl.h b/src/video/x11/SDL_x11opengl.h
index 1a26ea0..7331b71 100644
--- a/src/video/x11/SDL_x11opengl.h
+++ b/src/video/x11/SDL_x11opengl.h
@@ -38,14 +38,14 @@ struct SDL_GLDriverData
     SDL_bool HAS_GLX_ARB_create_context_robustness;
     SDL_bool HAS_GLX_ARB_create_context_no_error;
 
-	/* Max version of OpenGL ES context that can be created if the
-	   implementation supports GLX_EXT_create_context_es2_profile.
-	   major = minor = 0 when unsupported.
-	 */
-	struct {
-		int major;
-		int minor;
-	} es_profile_max_supported_version;
+    /* Max version of OpenGL ES context that can be created if the
+       implementation supports GLX_EXT_create_context_es2_profile.
+       major = minor = 0 when unsupported.
+     */
+    struct {
+        int major;
+        int minor;
+    } es_profile_max_supported_version;
 
     Bool (*glXQueryExtension) (Display*,int*,int*);
     void *(*glXGetProcAddress) (const GLubyte*);
diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h
index a07a030..a4c6d1d 100644
--- a/src/video/x11/SDL_x11sym.h
+++ b/src/video/x11/SDL_x11sym.h
@@ -45,7 +45,7 @@ SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char *
 SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
 SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
 SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return)
-SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char**	e),(a,b,c,d,e),return)
+SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return)
 SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return)
 SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
 SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
@@ -201,7 +201,7 @@ SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),)
 SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return)
 SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return)
 SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),)
-SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char*	b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return)
+SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return)
 SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return)
 SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return)
 #endif