| 1462 | // qt5webengine variant |
| 1463 | |
| 1464 | static bool qtwebengine(const int qtVersion, |
| 1465 | Display* const display, |
| 1466 | const Window winId, |
| 1467 | const int x, |
| 1468 | const int y, |
| 1469 | const uint width, |
| 1470 | const uint height, |
| 1471 | double scaleFactor, |
| 1472 | const char* const url, |
| 1473 | const char* const initialJS, |
| 1474 | WebViewRingBuffer* const shmptr) |
| 1475 | { |
| 1476 | void* lib; |
| 1477 | switch (qtVersion) |
| 1478 | { |
| 1479 | case 5: |
| 1480 | if ((lib = dlopen("libQt5WebEngineWidgets.so.5", RTLD_NOW|RTLD_GLOBAL)) == nullptr && |
| 1481 | (lib = dlopen("libQt5WebEngineWidgets.so", RTLD_NOW|RTLD_GLOBAL)) == nullptr) |
| 1482 | { |
| 1483 | d_stdout("WebView Qt5 platform not available: %s", dlerror()); |
| 1484 | return false; |
| 1485 | } |
| 1486 | break; |
| 1487 | case 6: |
| 1488 | if ((lib = dlopen("libQt6WebEngineWidgets.so.6", RTLD_NOW|RTLD_GLOBAL)) == nullptr && |
| 1489 | (lib = dlopen("libQt6WebEngineWidgets.so", RTLD_NOW|RTLD_GLOBAL)) == nullptr) |
| 1490 | { |
| 1491 | d_stdout("WebView Qt6 platform not available: %s", dlerror()); |
| 1492 | return false; |
| 1493 | } |
| 1494 | break; |
| 1495 | default: |
| 1496 | return false; |
| 1497 | } |
| 1498 | |
| 1499 | // Qt >= 6 uses int |
| 1500 | void (*QByteArray__init)(QByteArray*, const char*, int) = |
| 1501 | reinterpret_cast<typeof(QByteArray__init)>(dlsym(nullptr, "_ZN10QByteArrayC1EPKcx")) ?: |
| 1502 | reinterpret_cast<typeof(QByteArray__init)>(dlsym(nullptr, "_ZN10QByteArrayC1EPKci")); |
| 1503 | DISTRHO_SAFE_ASSERT_RETURN(QByteArray__init != nullptr, false); |
| 1504 | |
| 1505 | typedef void (*QString__init_t)(QString*, const QChar*, int); |
| 1506 | const QString__init_t QString__init = |
| 1507 | reinterpret_cast<QString__init_t>(dlsym(nullptr, "_ZN7QStringC2EPK5QCharx")) ?: |
| 1508 | reinterpret_cast<QString__init_t>(dlsym(nullptr, "_ZN7QStringC2EPK5QChari")); |
| 1509 | DISTRHO_SAFE_ASSERT_RETURN(QString__init != nullptr, false); |
| 1510 | |
| 1511 | void (*QWebEnginePage_setWebChannel)(QWebEnginePage*, QWebChannel*, uint) = |
| 1512 | reinterpret_cast<typeof(QWebEnginePage_setWebChannel)>(dlsym( |
| 1513 | nullptr, "_ZN14QWebEnginePage13setWebChannelEP11QWebChannelj")) ?: |
| 1514 | reinterpret_cast<typeof(QWebEnginePage_setWebChannel)>(dlsym( |
| 1515 | nullptr, "_ZN14QWebEnginePage13setWebChannelEP11QWebChannel")); |
| 1516 | DISTRHO_SAFE_ASSERT_RETURN(QWebEnginePage_setWebChannel != nullptr, false); |
| 1517 | |
| 1518 | // Qt >= 6 has new function signature with lambdas |
| 1519 | #ifdef DISTRHO_PROPER_CPP11_SUPPORT |
| 1520 | typedef void (*QWebEnginePage_runJavaScript_t)(QWebEnginePage*, const QString&, uint, const std::function<void()>&); |
| 1521 | #else |
no test coverage detected