Dynamic loading support for Wayland
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
diff --git a/configure b/configure
index a5ce2e3..6fcddc3 100755
--- a/configure
+++ b/configure
@@ -819,6 +819,7 @@ enable_diskaudio
enable_dummyaudio
enable_video_wayland
enable_video_wayland_qt_touch
+enable_wayland_shared
enable_video_x11
with_x
enable_x11_shared
@@ -1538,6 +1539,7 @@ Optional Features:
--enable-video-wayland-qt-touch
QtWayland server support for Wayland video driver
[[default=yes]]
+ --enable-wayland-shared dynamically load Wayland support [[default=maybe]]
--enable-video-x11 use X11 video driver [[default=yes]]
--enable-x11-shared dynamically load X11 support [[default=maybe]]
--enable-video-x11-xcursor
@@ -18705,8 +18707,8 @@ $as_echo_n "checking for Wayland support... " >&6; }
video_wayland=no
if test x$PKG_CONFIG != xno; then
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
- WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
- WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
+ WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
+ WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
video_wayland=yes
fi
fi
@@ -18724,7 +18726,69 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+ # Check whether --enable-wayland-shared was given.
+if test "${enable_wayland_shared+set}" = set; then :
+ enableval=$enable_wayland_shared;
+else
+ enable_wayland_shared=maybe
+fi
+
+
+ case "$host" in
+ *)
+ wayland_client_lib=`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+ wayland_egl_lib=`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+ if test x$wayland_egl_lib = x; then
+ wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+ fi
+ wayland_cursor_lib=`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+ xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+ ;;
+ esac
+
+ if test x$enable_wayland_shared = xmaybe; then
+ enable_wayland_shared=yes
+ fi
+ if test x$have_loadso != xyes && \
+ test x$enable_wayland_shared = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&5
+$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic WAYLAND loading" >&2;}
+ enable_wayland_shared=no
+ fi
+ if test x$have_loadso = xyes && \
+ test x$enable_wayland_shared = xyes && \
+ test x$wayland_client_lib != x && \
+ test x$wayland_egl_lib != x && \
+ test x$wayland_cursor_lib != x && \
+ test x$xkbcommon_lib != x; then
+ echo "-- dynamic libwayland-client -> $wayland_client_lib"
+ echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
+ echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
+ echo "-- dynamic xkbcommon -> $xkbcommon_lib"
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "$wayland_egl_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "$wayland_cursor_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "$xkbcommon_lib"
+_ACEOF
+
+ else
+ enable_wayland_shared=no
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+ fi
have_video=yes
fi
fi
diff --git a/configure.in b/configure.in
index 17f5d18..27eadba 100644
--- a/configure.in
+++ b/configure.in
@@ -1133,8 +1133,8 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
video_wayland=no
if test x$PKG_CONFIG != xno; then
if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
- WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
- WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
+ WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
+ WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
video_wayland=yes
fi
fi
@@ -1147,8 +1147,50 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
fi
SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
- dnl FIXME do dynamic loading code here.
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+ AC_ARG_ENABLE(wayland-shared,
+AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
+ , enable_wayland_shared=maybe)
+
+ dnl FIXME: Do BSD and OS X need special cases?
+ case "$host" in
+ *)
+ wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+ wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+ if test x$wayland_egl_lib = x; then
+ dnl This works in Ubuntu 13.10, maybe others
+ wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+ fi
+ wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+ xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+ ;;
+ esac
+
+ if test x$enable_wayland_shared = xmaybe; then
+ enable_wayland_shared=yes
+ fi
+ if test x$have_loadso != xyes && \
+ test x$enable_wayland_shared = xyes; then
+ AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic WAYLAND loading])
+ enable_wayland_shared=no
+ fi
+ if test x$have_loadso = xyes && \
+ test x$enable_wayland_shared = xyes && \
+ test x$wayland_client_lib != x && \
+ test x$wayland_egl_lib != x && \
+ test x$wayland_cursor_lib != x && \
+ test x$xkbcommon_lib != x; then
+ echo "-- dynamic libwayland-client -> $wayland_client_lib"
+ echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
+ echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
+ echo "-- dynamic xkbcommon -> $xkbcommon_lib"
+ AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
+ AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
+ AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
+ AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
+ else
+ enable_wayland_shared=no
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
+ fi
have_video=yes
fi
fi
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index e96bdfa..eb7b4b9 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -263,6 +263,10 @@
#undef SDL_VIDEO_DRIVER_WINDOWS
#undef SDL_VIDEO_DRIVER_WAYLAND
#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_RPI
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
diff --git a/src/video/wayland/SDL_waylanddyn.c b/src/video/wayland/SDL_waylanddyn.c
new file mode 100644
index 0000000..c2ee8d8
--- /dev/null
+++ b/src/video/wayland/SDL_waylanddyn.c
@@ -0,0 +1,195 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_WAYLAND
+
+#define DEBUG_DYNAMIC_WAYLAND 0
+
+#include "SDL_waylanddyn.h"
+
+#if DEBUG_DYNAMIC_WAYLAND
+#include "SDL_log.h"
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+typedef struct
+{
+ void *lib;
+ const char *libname;
+} waylanddynlib;
+
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON NULL
+#endif
+
+static waylanddynlib waylandlibs[] = {
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC},
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL},
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR},
+ {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON}
+};
+
+static void *
+WAYLAND_GetSym(const char *fnname, int *pHasModule)
+{
+ int i;
+ void *fn = NULL;
+ for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+ if (waylandlibs[i].lib != NULL) {
+ fn = SDL_LoadFunction(waylandlibs[i].lib, fnname);
+ if (fn != NULL)
+ break;
+ }
+ }
+
+#if DEBUG_DYNAMIC_WAYLAND
+ if (fn != NULL)
+ SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, waylandlibs[i].libname, fn);
+ else
+ SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname);
+#endif
+
+ if (fn == NULL)
+ *pHasModule = 0; /* kill this module. */
+
+ return fn;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
+
+/* Define all the function pointers and wrappers... */
+#define SDL_WAYLAND_MODULE(modname) int SDL_WAYLAND_HAVE_##modname = 0;
+#define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL;
+#define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+static int wayland_load_refcount = 0;
+
+void
+SDL_WAYLAND_UnloadSymbols(void)
+{
+ /* Don't actually unload if more than one module is using the libs... */
+ if (wayland_load_refcount > 0) {
+ if (--wayland_load_refcount == 0) {
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ int i;
+#endif
+
+ /* set all the function pointers to NULL. */
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 0;
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL;
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+ if (waylandlibs[i].lib != NULL) {
+ SDL_UnloadObject(waylandlibs[i].lib);
+ waylandlibs[i].lib = NULL;
+ }
+ }
+#endif
+ }
+ }
+}
+
+/* returns non-zero if all needed symbols were loaded. */
+int
+SDL_WAYLAND_LoadSymbols(void)
+{
+ int rc = 1; /* always succeed if not using Dynamic WAYLAND stuff. */
+
+ /* deal with multiple modules (dga, wayland, etc) needing these symbols... */
+ if (wayland_load_refcount++ == 0) {
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ int i;
+ int *thismod = NULL;
+ for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) {
+ if (waylandlibs[i].libname != NULL) {
+ waylandlibs[i].lib = SDL_LoadObject(waylandlibs[i].libname);
+ }
+ }
+
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
+#define SDL_WAYLAND_SYM(rc,fn,params)
+#define SDL_WAYLAND_INTERFACE(iface)
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+#define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname;
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod);
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod);
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+ if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) {
+ /* all required symbols loaded. */
+ SDL_ClearError();
+ } else {
+ /* in case something got loaded... */
+ SDL_WAYLAND_UnloadSymbols();
+ rc = 0;
+ }
+
+#else /* no dynamic WAYLAND */
+
+#define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */
+#define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
+#define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+#endif
+ }
+
+ return rc;
+}
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
new file mode 100644
index 0000000..bf1bc92
--- /dev/null
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -0,0 +1,103 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#ifndef _SDL_waylanddyn_h
+#define _SDL_waylanddyn_h
+
+#include "../../SDL_internal.h"
+
+/* We can't include wayland-client.h here
+ * but we need some structs from it
+ */
+struct wl_interface;
+struct wl_proxy;
+struct wl_event_queue;
+struct wl_display;
+struct wl_surface;
+struct wl_shm;
+
+#include <stdint.h>
+#include "wayland-cursor.h"
+#include "wayland-util.h"
+#include "xkbcommon/xkbcommon.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+int SDL_WAYLAND_LoadSymbols(void);
+void SDL_WAYLAND_UnloadSymbols(void);
+
+#define SDL_WAYLAND_MODULE(modname) extern int SDL_WAYLAND_HAVE_##modname;
+#define SDL_WAYLAND_SYM(rc,fn,params) \
+ typedef rc (*SDL_DYNWAYLANDFN_##fn) params; \
+ extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn;
+#define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface;
+#include "SDL_waylandsym.h"
+#undef SDL_WAYLAND_MODULE
+#undef SDL_WAYLAND_SYM
+#undef SDL_WAYLAND_INTERFACE
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+
+#ifdef _WAYLAND_CLIENT_H
+#error Do not include wayland-client ahead of SDL_waylanddyn.h in dynamic loading mode
+#endif
+
+/* wayland-client-protocol.h included from wayland-client.h
+ * has inline functions that require these to be defined in dynamic loading mode
+ */
+
+#define wl_proxy_create (*WAYLAND_wl_proxy_create)
+#define wl_proxy_destroy (*WAYLAND_wl_proxy_destroy)
+#define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal)
+#define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data)
+#define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data)
+#define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener)
+
+#define wl_seat_interface (*WAYLAND_wl_seat_interface)
+#define wl_surface_interface (*WAYLAND_wl_surface_interface)
+#define wl_shm_pool_interface (*WAYLAND_wl_shm_pool_interface)
+#define wl_buffer_interface (*WAYLAND_wl_buffer_interface)
+#define wl_registry_interface (*WAYLAND_wl_registry_interface)
+#define wl_shell_surface_interface (*WAYLAND_wl_shell_surface_interface)
+#define wl_region_interface (*WAYLAND_wl_region_interface)
+#define wl_pointer_interface (*WAYLAND_wl_pointer_interface)
+#define wl_keyboard_interface (*WAYLAND_wl_keyboard_interface)
+#define wl_compositor_interface (*WAYLAND_wl_compositor_interface)
+#define wl_output_interface (*WAYLAND_wl_output_interface)
+#define wl_shell_interface (*WAYLAND_wl_shell_interface)
+#define wl_shm_interface (*WAYLAND_wl_shm_interface)
+
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
+
+#include "wayland-client.h"
+#include "wayland-egl.h"
+
+#endif /* !defined _SDL_waylanddyn_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index b002a05..3af798d 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#include "SDL_stdinc.h"
#include "SDL_assert.h"
@@ -32,6 +32,8 @@
#include "SDL_waylandevents_c.h"
#include "SDL_waylandwindow.h"
+#include "SDL_waylanddyn.h"
+
#include <linux/input.h>
#include <sys/select.h>
#include <sys/mman.h>
@@ -60,14 +62,14 @@ Wayland_PumpEvents(_THIS)
SDL_VideoData *d = _this->driverdata;
struct pollfd pfd[1];
- pfd[0].fd = wl_display_get_fd(d->display);
+ pfd[0].fd = WAYLAND_wl_display_get_fd(d->display);
pfd[0].events = POLLIN;
poll(pfd, 1, 0);
if (pfd[0].revents & POLLIN)
- wl_display_dispatch(d->display);
+ WAYLAND_wl_display_dispatch(d->display);
else
- wl_display_dispatch_pending(d->display);
+ WAYLAND_wl_display_dispatch_pending(d->display);
}
static void
@@ -199,7 +201,7 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
return;
}
- input->xkb.keymap = xkb_map_new_from_string(input->display->xkb_context,
+ input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context,
map_str,
XKB_KEYMAP_FORMAT_TEXT_V1,
0);
@@ -211,10 +213,10 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
return;
}
- input->xkb.state = xkb_state_new(input->xkb.keymap);
+ input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap);
if (!input->xkb.state) {
fprintf(stderr, "failed to create XKB state\n");
- xkb_map_unref(input->xkb.keymap);
+ WAYLAND_xkb_keymap_unref(input->xkb.keymap);
input->xkb.keymap = NULL;
return;
}
@@ -266,11 +268,11 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
return;
// TODO can this happen?
- if (xkb_key_get_syms(input->xkb.state, key + 8, &syms) != 1)
+ if (WAYLAND_xkb_state_key_get_syms(input->xkb.state, key + 8, &syms) != 1)
return;
if (state) {
- size = xkb_keysym_to_utf8(syms[0], text, sizeof text);
+ size = WAYLAND_xkb_keysym_to_utf8(syms[0], text, sizeof text);
if (size > 0) {
text[size] = 0;
@@ -287,7 +289,7 @@ keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
{
struct SDL_WaylandInput *input = data;
- xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
+ WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched,
mods_locked, 0, 0, group);
}
@@ -349,7 +351,7 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id)
wl_seat_add_listener(input->seat, &seat_listener, input);
wl_seat_set_user_data(input->seat, input);
- wayland_schedule_write(d);
+ WAYLAND_wl_display_flush(d->display);
}
void Wayland_display_destroy_input(SDL_VideoData *d)
@@ -369,10 +371,10 @@ void Wayland_display_destroy_input(SDL_VideoData *d)
wl_seat_destroy(input->seat);
if (input->xkb.state)
- xkb_state_unref(input->xkb.state);
+ WAYLAND_xkb_state_unref(input->xkb.state);
if (input->xkb.keymap)
- xkb_map_unref(input->xkb.keymap);
+ WAYLAND_xkb_keymap_unref(input->xkb.keymap);
free(input);
d->input = NULL;
diff --git a/src/video/wayland/SDL_waylandevents_c.h b/src/video/wayland/SDL_waylandevents_c.h
index ed5ff7c..cc88cde 100644
--- a/src/video/wayland/SDL_waylandevents_c.h
+++ b/src/video/wayland/SDL_waylandevents_c.h
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#ifndef _SDL_waylandevents_h
#define _SDL_waylandevents_h
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 62c65e9..3609db6 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -31,14 +31,17 @@
#include <stdlib.h>
#include <limits.h>
+#include "../../SDL_internal.h"
#include "../SDL_sysvideo.h"
-#include "SDL_config.h"
#include "SDL_mouse.h"
#include "../../events/SDL_mouse_c.h"
#include "SDL_waylandvideo.h"
#include "SDL_waylandevents_c.h"
+#include "SDL_waylanddyn.h"
+#include "wayland-cursor.h"
+
#include "SDL_assert.h"
#if SDL_VIDEO_DRIVER_WAYLAND
@@ -210,7 +213,7 @@ CreateCursorFromWlCursor(SDL_VideoData *d, struct wl_cursor *wlcursor)
data->buffer = NULL;
data->surface = wl_compositor_create_surface(d->compositor);
wl_surface_attach(data->surface,
- wl_cursor_image_get_buffer(wlcursor->images[0]),
+ WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]),
0,
0);
wl_surface_damage(data->surface,
@@ -236,7 +239,7 @@ Wayland_CreateDefaultCursor()
SDL_VideoData *data = device->driverdata;
return CreateCursorFromWlCursor (data,
- wl_cursor_theme_get_cursor(data->cursor_theme,
+ WAYLAND_wl_cursor_theme_get_cursor(data->cursor_theme,
"left_ptr"));
}
@@ -254,40 +257,40 @@ Wayland_CreateSystemCursor(SDL_SystemCursor id)
SDL_assert(0);
return NULL;
case SDL_SYSTEM_CURSOR_ARROW:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
break;
case SDL_SYSTEM_CURSOR_IBEAM:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
break;
case SDL_SYSTEM_CURSOR_WAIT:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
break;
case SDL_SYSTEM_CURSOR_CROSSHAIR:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
break;
case SDL_SYSTEM_CURSOR_WAITARROW:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "wait");
break;
case SDL_SYSTEM_CURSOR_SIZENWSE:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
break;
case SDL_SYSTEM_CURSOR_SIZENESW:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
break;
case SDL_SYSTEM_CURSOR_SIZEWE:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
break;
case SDL_SYSTEM_CURSOR_SIZENS:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
break;
case SDL_SYSTEM_CURSOR_SIZEALL:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
break;
case SDL_SYSTEM_CURSOR_NO:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "xterm");
break;
case SDL_SYSTEM_CURSOR_HAND:
- cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
+ cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "hand1");
break;
}
diff --git a/src/video/wayland/SDL_waylandmouse.h b/src/video/wayland/SDL_waylandmouse.h
index f434b9d..3ccd7f1 100644
--- a/src/video/wayland/SDL_waylandmouse.h
+++ b/src/video/wayland/SDL_waylandmouse.h
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#include "SDL_mouse.h"
#include "SDL_waylandvideo.h"
diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c
index 7a13839..47f0161 100644
--- a/src/video/wayland/SDL_waylandopengles.c
+++ b/src/video/wayland/SDL_waylandopengles.c
@@ -18,7 +18,7 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL
@@ -26,6 +26,7 @@
#include "SDL_waylandopengles.h"
#include "SDL_waylandwindow.h"
#include "SDL_waylandevents_c.h"
+#include "SDL_waylanddyn.h"
/* EGL implementation of SDL OpenGL ES support */
@@ -37,7 +38,7 @@ Wayland_GLES_LoadLibrary(_THIS, const char *path) {
ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display);
Wayland_PumpEvents(_this);
- wayland_schedule_write(data);
+ WAYLAND_wl_display_flush(data->display);
return ret;
}
@@ -48,7 +49,7 @@ Wayland_GLES_CreateContext(_THIS, SDL_Window * window)
{
SDL_GLContext context;
context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
- wayland_schedule_write(_this->driverdata);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
return context;
}
@@ -57,7 +58,7 @@ void
Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
{
SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
- wayland_schedule_write(_this->driverdata);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
}
@@ -73,7 +74,7 @@ Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
}
- wayland_schedule_write(_this->driverdata);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
return ret;
}
@@ -82,7 +83,7 @@ void
Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
{
SDL_EGL_DeleteContext(_this, context);
- wayland_schedule_write(_this->driverdata);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL */
diff --git a/src/video/wayland/SDL_waylandopengles.h b/src/video/wayland/SDL_waylandopengles.h
index 2deed0c..084a4bd 100644
--- a/src/video/wayland/SDL_waylandopengles.h
+++ b/src/video/wayland/SDL_waylandopengles.h
@@ -18,7 +18,7 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#ifndef _SDL_waylandopengles_h
#define _SDL_waylandopengles_h
diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h
new file mode 100644
index 0000000..1494d3f
--- /dev/null
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -0,0 +1,102 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* *INDENT-OFF* */
+
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT)
+SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...))
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *))
+SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *))
+SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *))
+SDL_WAYLAND_SYM(void, wl_proxy_set_user_data, (struct wl_proxy *, void *))
+SDL_WAYLAND_SYM(void *, wl_proxy_get_user_data, (struct wl_proxy *))
+SDL_WAYLAND_SYM(uint32_t, wl_proxy_get_id, (struct wl_proxy *))
+SDL_WAYLAND_SYM(const char *, wl_proxy_get_class, (struct wl_proxy *))
+SDL_WAYLAND_SYM(void, wl_proxy_set_queue, (struct wl_proxy *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect, (const char *))
+SDL_WAYLAND_SYM(struct wl_display *, wl_display_connect_to_fd, (int))
+SDL_WAYLAND_SYM(void, wl_display_disconnect, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_get_fd, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_queue, (struct wl_display *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_queue_pending, (struct wl_display *, struct wl_event_queue *))
+SDL_WAYLAND_SYM(int, wl_display_dispatch_pending, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_get_error, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_flush, (struct wl_display *))
+SDL_WAYLAND_SYM(int, wl_display_roundtrip, (struct wl_display *))
+SDL_WAYLAND_SYM(struct wl_event_queue *, wl_display_create_queue, (struct wl_display *))
+SDL_WAYLAND_SYM(void, wl_log_set_handler_client, (wl_log_func_t))
+SDL_WAYLAND_SYM(void, wl_list_init, (struct wl_list *))
+SDL_WAYLAND_SYM(void, wl_list_insert, (struct wl_list *, struct wl_list *) )
+SDL_WAYLAND_SYM(void, wl_list_remove, (struct wl_list *))
+SDL_WAYLAND_SYM(int, wl_list_length, (const struct wl_list *))
+SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *))
+SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *))
+
+SDL_WAYLAND_INTERFACE(wl_seat_interface)
+SDL_WAYLAND_INTERFACE(wl_surface_interface)
+SDL_WAYLAND_INTERFACE(wl_shm_pool_interface)
+SDL_WAYLAND_INTERFACE(wl_buffer_interface)
+SDL_WAYLAND_INTERFACE(wl_registry_interface)
+SDL_WAYLAND_INTERFACE(wl_shell_surface_interface)
+SDL_WAYLAND_INTERFACE(wl_region_interface)
+SDL_WAYLAND_INTERFACE(wl_pointer_interface)
+SDL_WAYLAND_INTERFACE(wl_keyboard_interface)
+SDL_WAYLAND_INTERFACE(wl_compositor_interface)
+SDL_WAYLAND_INTERFACE(wl_output_interface)
+SDL_WAYLAND_INTERFACE(wl_shell_interface)
+SDL_WAYLAND_INTERFACE(wl_shm_interface)
+
+SDL_WAYLAND_MODULE(WAYLAND_EGL)
+SDL_WAYLAND_SYM(struct wl_egl_window *, wl_egl_window_create, (struct wl_surface *, int, int))
+SDL_WAYLAND_SYM(void, wl_egl_window_destroy, (struct wl_egl_window *))
+SDL_WAYLAND_SYM(void, wl_egl_window_resize, (struct wl_egl_window *, int, int, int, int))
+SDL_WAYLAND_SYM(void, wl_egl_window_get_attached_size, (struct wl_egl_window *, int *, int *))
+
+SDL_WAYLAND_MODULE(WAYLAND_CURSOR)
+SDL_WAYLAND_SYM(struct wl_cursor_theme *, wl_cursor_theme_load, (const char *, int , struct wl_shm *))
+SDL_WAYLAND_SYM(void, wl_cursor_theme_destroy, (struct wl_cursor_theme *))
+SDL_WAYLAND_SYM(struct wl_cursor *, wl_cursor_theme_get_cursor, (struct wl_cursor_theme *, const char *))
+SDL_WAYLAND_SYM(struct wl_buffer *, wl_cursor_image_get_buffer, (struct wl_cursor_image *))
+SDL_WAYLAND_SYM(int, wl_cursor_frame, (struct wl_cursor *, uint32_t))
+
+SDL_WAYLAND_MODULE(WAYLAND_XKB)
+SDL_WAYLAND_SYM(int, xkb_state_key_get_syms, (struct xkb_state *, xkb_keycode_t, const xkb_keysym_t **))
+SDL_WAYLAND_SYM(int, xkb_keysym_to_utf8, (xkb_keysym_t, char *, size_t) )
+SDL_WAYLAND_SYM(struct xkb_keymap *, xkb_keymap_new_from_string, (struct xkb_context *, const char *, enum xkb_keymap_format, enum xkb_keymap_compile_flags))
+SDL_WAYLAND_SYM(struct xkb_state *, xkb_state_new, (struct xkb_keymap *) )
+SDL_WAYLAND_SYM(void, xkb_keymap_unref, (struct xkb_keymap *) )
+SDL_WAYLAND_SYM(void, xkb_state_unref, (struct xkb_state *) )
+SDL_WAYLAND_SYM(void, xkb_context_unref, (struct xkb_context *) )
+SDL_WAYLAND_SYM(struct xkb_context *, xkb_context_new, (enum xkb_context_flags flags) )
+SDL_WAYLAND_SYM(enum xkb_state_component, xkb_state_update_mask, (struct xkb_state *state,\
+ xkb_mod_mask_t depressed_mods,\
+ xkb_mod_mask_t latched_mods,\
+ xkb_mod_mask_t locked_mods,\
+ xkb_layout_index_t depressed_layout,\
+ xkb_layout_index_t latched_layout,\
+ xkb_layout_index_t locked_layout) )
+
+
+/* *INDENT-ON* */
+
+/* vi: set ts=4 sw=4 expandtab: */
+//SDL_WAYLAND_SYM(ret, fn, params)
\ No newline at end of file
diff --git a/src/video/wayland/SDL_waylandtouch.c b/src/video/wayland/SDL_waylandtouch.c
index 9edf2e7..2c55d6d 100644
--- a/src/video/wayland/SDL_waylandtouch.c
+++ b/src/video/wayland/SDL_waylandtouch.c
@@ -21,7 +21,7 @@
/* Contributed by Thomas Perl <thomas.perl@jollamobile.com> */
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
@@ -118,6 +118,7 @@ touch_handle_configure(void *data,
{
}
+
/* wayland-qt-touch-extension.c BEGINS */
static const struct qt_touch_extension_listener touch_listener = {
@@ -183,13 +184,23 @@ WL_EXPORT const struct wl_interface qt_windowmanager_interface = {
/* wayland-qt-surface-extension.c BEGINS */
extern const struct wl_interface qt_extended_surface_interface;
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
extern const struct wl_interface wl_surface_interface;
+#endif
static const struct wl_interface *qt_surface_extension_types[] = {
NULL,
NULL,
&qt_extended_surface_interface,
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
+ /* FIXME: Set this dynamically to (*WAYLAND_wl_surface_interface) ?
+ * The value comes from auto generated code and does
+ * not appear to actually be used anywhere
+ */
+ NULL,
+#else
&wl_surface_interface,
+#endif
};
static const struct wl_message qt_surface_extension_requests[] = {
diff --git a/src/video/wayland/SDL_waylandtouch.h b/src/video/wayland/SDL_waylandtouch.h
index ccb645b..fe51499 100644
--- a/src/video/wayland/SDL_waylandtouch.h
+++ b/src/video/wayland/SDL_waylandtouch.h
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
@@ -29,8 +29,9 @@
#include "SDL_waylandvideo.h"
#include <stdint.h>
#include <stddef.h>
-#include "wayland-client.h"
#include "wayland-util.h"
+#include "SDL_waylanddyn.h"
+
void Wayland_touch_create(SDL_VideoData *data, uint32_t id);
void Wayland_touch_destroy(SDL_VideoData *data);
@@ -89,7 +90,7 @@ qt_surface_extension_get_user_data(struct qt_surface_extension *qt_surface_exten
static inline void
qt_surface_extension_destroy(struct qt_surface_extension *qt_surface_extension)
{
- wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_surface_extension);
}
static inline struct qt_extended_surface *
@@ -102,7 +103,7 @@ qt_surface_extension_get_extended_surface(struct qt_surface_extension *qt_surfac
if (!id)
return NULL;
- wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_surface_extension,
QT_SURFACE_EXTENSION_GET_EXTENDED_SURFACE, id, surface);
return (struct qt_extended_surface *) id;
@@ -166,39 +167,39 @@ qt_extended_surface_add_listener(struct qt_extended_surface *qt_extended_surface
static inline void
qt_extended_surface_set_user_data(struct qt_extended_surface *qt_extended_surface, void *user_data)
{
- wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
+ WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_extended_surface, user_data);
}
static inline void *
qt_extended_surface_get_user_data(struct qt_extended_surface *qt_extended_surface)
{
- return wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
+ return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_extended_surface);
}
static inline void
qt_extended_surface_destroy(struct qt_extended_surface *qt_extended_surface)
{
- wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_extended_surface);
}
static inline void
qt_extended_surface_update_generic_property(struct qt_extended_surface *qt_extended_surface, const char *name, struct wl_array *value)
{
- wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
QT_EXTENDED_SURFACE_UPDATE_GENERIC_PROPERTY, name, value);
}
static inline void
qt_extended_surface_set_content_orientation(struct qt_extended_surface *qt_extended_surface, int32_t orientation)
{
- wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
QT_EXTENDED_SURFACE_SET_CONTENT_ORIENTATION, orientation);
}
static inline void
qt_extended_surface_set_window_flags(struct qt_extended_surface *qt_extended_surface, int32_t flags)
{
- wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_extended_surface,
QT_EXTENDED_SURFACE_SET_WINDOW_FLAGS, flags);
}
@@ -269,25 +270,25 @@ qt_touch_extension_add_listener(struct qt_touch_extension *qt_touch_extension,
static inline void
qt_touch_extension_set_user_data(struct qt_touch_extension *qt_touch_extension, void *user_data)
{
- wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
+ WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_touch_extension, user_data);
}
static inline void *
qt_touch_extension_get_user_data(struct qt_touch_extension *qt_touch_extension)
{
- return wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
+ return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_touch_extension);
}
static inline void
qt_touch_extension_destroy(struct qt_touch_extension *qt_touch_extension)
{
- wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_touch_extension);
}
static inline void
qt_touch_extension_dummy(struct qt_touch_extension *qt_touch_extension)
{
- wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_touch_extension,
QT_TOUCH_EXTENSION_DUMMY);
}
@@ -324,25 +325,25 @@ qt_windowmanager_add_listener(struct qt_windowmanager *qt_windowmanager,
static inline void
qt_windowmanager_set_user_data(struct qt_windowmanager *qt_windowmanager, void *user_data)
{
- wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
+ WAYLAND_wl_proxy_set_user_data((struct wl_proxy *) qt_windowmanager, user_data);
}
static inline void *
qt_windowmanager_get_user_data(struct qt_windowmanager *qt_windowmanager)
{
- return wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
+ return WAYLAND_wl_proxy_get_user_data((struct wl_proxy *) qt_windowmanager);
}
static inline void
qt_windowmanager_destroy(struct qt_windowmanager *qt_windowmanager)
{
- wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
+ WAYLAND_wl_proxy_destroy((struct wl_proxy *) qt_windowmanager);
}
static inline void
qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t remaining, const char *url)
{
- wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
+ WAYLAND_wl_proxy_marshal((struct wl_proxy *) qt_windowmanager,
QT_WINDOWMANAGER_OPEN_URL, remaining, url);
}
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 5c845ac..b8db469 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -19,10 +19,11 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#include "SDL_video.h"
#include "SDL_mouse.h"
+#include "SDL_stdinc.h"
#include "../../events/SDL_events_c.h"
#include "SDL_waylandvideo.h"
@@ -35,6 +36,9 @@
#include <fcntl.h>
#include <xkbcommon/xkbcommon.h>
+#include "SDL_waylanddyn.h"
+#include <wayland-util.h>
+
#define WAYLANDVID_DRIVER_NAME "wayland"
struct wayland_mode {
@@ -59,10 +63,12 @@ static int
Wayland_Available(void)
{
struct wl_display *display = NULL;
-
- display = wl_display_connect(NULL);
- if (display != NULL) {
- wl_display_disconnect(display);
+ if (SDL_WAYLAND_LoadSymbols()) {
+ display = WAYLAND_wl_display_connect(NULL);
+ if (display != NULL) {
+ WAYLAND_wl_display_disconnect(display);
+ }
+ SDL_WAYLAND_UnloadSymbols();
}
return (display != NULL);
@@ -72,12 +78,17 @@ static void
Wayland_DeleteDevice(SDL_VideoDevice *device)
{
SDL_free(device);
+ SDL_WAYLAND_UnloadSymbols();
}
static SDL_VideoDevice *
Wayland_CreateDevice(int devindex)
{
SDL_VideoDevice *device;
+
+ if (!SDL_WAYLAND_LoadSymbols()) {
+ return NULL;
+ }
/* Initialize all variables that we clean on shutdown */
device = SDL_calloc(1, sizeof(SDL_VideoDevice));
@@ -133,13 +144,13 @@ wayland_add_mode(SDL_VideoData *d, SDL_DisplayMode m)
return;
/* Add new mode to the list */
- mode = SDL_calloc(1, sizeof *mode);
+ mode = (struct wayland_mode *) SDL_calloc(1, sizeof *mode);
if (!mode)
return;
mode->mode = m;
- wl_list_insert(&d->modes_list, &mode->link);
+ WAYLAND_wl_list_insert(&d->modes_list, &mode->link);
}
static void
@@ -227,7 +238,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
{
SDL_VideoData *d = data;
-
+
if (strcmp(interface, "wl_compositor") == 0) {
d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, 1);
} else if (strcmp(interface, "wl_output") == 0) {
@@ -239,8 +250,8 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1);
} else if (strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
- d->cursor_theme = wl_cursor_theme_load(NULL, 32, d->shm);
- d->default_cursor = wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
+ d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
+ d->default_cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
wl_shm_add_listener(d->shm, &shm_listener, d);
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
@@ -265,7 +276,10 @@ int
Wayland_VideoInit(_THIS)
{
SDL_VideoData *data;
-
+ SDL_VideoDisplay display;
+ SDL_DisplayMode mode;
+ int i;
+
data = malloc(sizeof *data);
if (data == NULL)
return 0;
@@ -273,29 +287,41 @@ Wayland_VideoInit(_THIS)
_this->driverdata = data;
- wl_list_init(&data->modes_list);
+ WAYLAND_wl_list_init(&data->modes_list);
- data->display = wl_display_connect(NULL);
+ data->display = WAYLAND_wl_display_connect(NULL);
if (data->display == NULL) {
SDL_SetError("Failed to connect to a Wayland display");
return 0;
}
data->registry = wl_display_get_registry(data->display);
+
+ if ( data->registry == NULL) {
+ SDL_SetError("Failed to get the Wayland registry");
+ return 0;
+ }
+
wl_registry_add_listener(data->registry, ®istry_listener, data);
- while (data->screen_allocation.width == 0)
- wl_display_dispatch(data->display);
+ for (i=0; i < 100; i++) {
+ if (data->screen_allocation.width != 0 || WAYLAND_wl_display_get_error(data->display) != 0) {
+ break;
+ }
+ WAYLAND_wl_display_dispatch(data->display);
+ }
+
+ if (data->screen_allocation.width == 0) {
+ SDL_SetError("Failed while waiting for screen allocation: %d ", WAYLAND_wl_display_get_error(data->display));
+ return 0;
+ }
- data->xkb_context = xkb_context_new(0);
+ data->xkb_context = WAYLAND_xkb_context_new(0);
if (!data->xkb_context) {
SDL_SetError("Failed to create XKB context");
return 0;
}
- SDL_VideoDisplay display;
- SDL_DisplayMode mode;
-
/* Use a fake 32-bpp desktop mode */
mode.format = SDL_PIXELFORMAT_RGB888;
mode.w = data->screen_allocation.width;
@@ -311,7 +337,7 @@ Wayland_VideoInit(_THIS)
Wayland_InitMouse ();
- wayland_schedule_write(data);
+ WAYLAND_wl_display_flush(data->display);
return 0;
}
@@ -363,7 +389,7 @@ Wayland_VideoQuit(_THIS)
Wayland_display_destroy_input(data);
if (data->xkb_context) {
- xkb_context_unref(data->xkb_context);
+ WAYLAND_xkb_context_unref(data->xkb_context);
data->xkb_context = NULL;
}
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
@@ -380,7 +406,7 @@ Wayland_VideoQuit(_THIS)
wl_shm_destroy(data->shm);
if (data->cursor_theme)
- wl_cursor_theme_destroy(data->cursor_theme);
+ WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);
if (data->shell)
wl_shell_destroy(data->shell);
@@ -389,12 +415,12 @@ Wayland_VideoQuit(_THIS)
wl_compositor_destroy(data->compositor);
if (data->display) {
- wl_display_flush(data->display);
- wl_display_disconnect(data->display);
+ WAYLAND_wl_display_flush(data->display);
+ WAYLAND_wl_display_disconnect(data->display);
}
wl_list_for_each_safe(m, t, &data->modes_list, link) {
- wl_list_remove(&m->link);
+ WAYLAND_wl_list_remove(&m->link);
free(m);
}
diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h
index c44a264..71f9304 100644
--- a/src/video/wayland/SDL_waylandvideo.h
+++ b/src/video/wayland/SDL_waylandvideo.h
@@ -19,16 +19,13 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#ifndef _SDL_waylandvideo_h
#define _SDL_waylandvideo_h
-#include <wayland-client.h>
-#include <wayland-cursor.h>
-#include <wayland-egl.h>
-
#include <EGL/egl.h>
+#include "wayland-util.h"
struct xkb_context;
struct SDL_WaylandInput;
@@ -72,12 +69,6 @@ typedef struct {
uint32_t shm_formats;
} SDL_VideoData;
-static inline void
-wayland_schedule_write(SDL_VideoData *data)
-{
- wl_display_flush(data->display);
-}
-
#endif /* _SDL_nullvideo_h */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index f864520..090c494 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#include "../SDL_sysvideo.h"
#include "../../events/SDL_windowevents_c.h"
@@ -104,7 +104,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
else
wl_shell_surface_set_toplevel(wind->shell_surface);
- wayland_schedule_write(_this->driverdata);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
}
void
@@ -120,7 +120,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
else
wl_shell_surface_set_toplevel(wind->shell_surface);
- wayland_schedule_write(_this->driverdata);
+ WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
}
int Wayland_CreateWindow(_THIS, SDL_Window *window)
@@ -162,7 +162,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
c->surface_extension, data->surface);
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
- data->egl_window = wl_egl_window_create(data->surface,
+ data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
window->w, window->h);
/* Create the GLES window surface */
@@ -192,7 +192,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
wl_surface_set_opaque_region(data->surface, region);
wl_region_destroy(region);
- wayland_schedule_write(c);
+ WAYLAND_wl_display_flush(c->display);
return 0;
}
@@ -203,9 +203,9 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
SDL_WindowData *wind = window->driverdata;
struct wl_region *region;
- wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
+ WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
- region = wl_compositor_create_region(data->compositor);
+ region =wl_compositor_create_region(data->compositor);
wl_region_add(region, 0, 0, window->w, window->h);
wl_surface_set_opaque_region(wind->surface, region);
wl_region_destroy(region);
@@ -220,7 +220,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
if (data) {
SDL_EGL_DestroySurface(_this, wind->egl_surface);
- wl_egl_window_destroy(wind->egl_window);
+ WAYLAND_wl_egl_window_destroy(wind->egl_window);
if (wind->shell_surface)
wl_shell_surface_destroy(wind->shell_surface);
@@ -232,7 +232,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
wl_surface_destroy(wind->surface);
SDL_free(wind);
- wayland_schedule_write(data);
+ WAYLAND_wl_display_flush(data->display);
}
}
diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h
index f65dc8f..789c43d 100644
--- a/src/video/wayland/SDL_waylandwindow.h
+++ b/src/video/wayland/SDL_waylandwindow.h
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
-#include "SDL_config.h"
+#include "../../SDL_internal.h"
#ifndef _SDL_waylandwindow_h
#define _SDL_waylandwindow_h