Skip to content

Commit

Permalink
Fix linux UI build
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Mar 16, 2024
1 parent c405780 commit 818ee74
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
else
freetypepkgname="libfreetype-dev"
fi
apt-get install -yqq ${freetypepkgname} libgl1-mesa-dev libx11-dev libxcursor-dev libxext-dev libxrandr-dev p7zip-full unzip wget xdg-user-dirs zip
apt-get install -yqq ${freetypepkgname} libgl1-mesa-dev libx11-dev libxcursor-dev libxext-dev libxrandr-dev libxxf86vm-dev p7zip-full unzip wget xdg-user-dirs zip
- name: Set up cache
id: cache
uses: actions/cache@v3
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
else
freetypepkgname="libfreetype-dev"
fi
apt-get install -yqq ${freetypepkgname} libgl1-mesa-dev libx11-dev libxcursor-dev libxext-dev libxrandr-dev p7zip-full unzip wget xdg-user-dirs zip
apt-get install -yqq ${freetypepkgname} libgl1-mesa-dev libx11-dev libxcursor-dev libxext-dev libxrandr-dev libxxf86vm-dev p7zip-full unzip wget xdg-user-dirs zip
- name: Set up cache
id: cache
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion src/PawPaw
1 change: 1 addition & 0 deletions src/plugin/DistrhoPluginInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
#define DISTRHO_PLUGIN_WANT_STATE 1
#define DISTRHO_PLUGIN_WANT_FULL_STATE 1
#define DISTRHO_PLUGIN_WANT_WEBVIEW 1
#define DISTRHO_UI_FILE_BROWSER 0
#define DISTRHO_UI_DEFAULT_WIDTH 1170
#define DISTRHO_UI_DEFAULT_HEIGHT 600
Expand Down
1 change: 1 addition & 0 deletions src/plugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ endif

DPF_BUILD_DIR = ../../build-plugin/build
DPF_TARGET_DIR = ../../build-plugin
USING_WEBVIEW = true

include ../DPF/Makefile.plugins.mk

Expand Down
26 changes: 13 additions & 13 deletions src/plugin/WebViewX11.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2023-2024 MOD Audio UG
// SPDX-License-Identifier: AGPL-3.0-or-later

#define QT_NO_VERSION_TAGGING
#include <QtCore/QChar>
#include <QtCore/QPoint>
#include <QtCore/QSize>
Expand Down Expand Up @@ -88,7 +89,7 @@ void* addWebView(const uintptr_t parentWinId, const double scaleFactor, const ui
ipc->childWindow = 0;
ipc->ourWindow = parentWinId;

const char* const args[] = { ldlinux, filename, nullptr };
const char* const args[] = { ldlinux, filename, "dpf-ld-linux-webview", nullptr };
ipc->p.start(args, envp);

for (uint i = 0; envp[i] != nullptr; ++i)
Expand Down Expand Up @@ -294,7 +295,7 @@ static bool qt5webengine(const Window winId, const double scaleFactor, const cha
using QApplication__init_t = void (*)(QApplication*, int&, char**, int);
using QApplication_exec_t = void (*)();
using QApplication_setAttribute_t = void (*)(Qt::ApplicationAttribute, bool);
using QString__init_t = void (*)(void*, const QChar*, qsizetype);
using QString__init_t = void (*)(void*, const QChar*, ptrdiff_t);
using QUrl__init_t = void (*)(void*, const QString&, int /* QUrl::ParsingMode */);
using QWebEngineView__init_t = void (*)(QWebEngineView*, void*);
using QWebEngineView_move_t = void (*)(QWebEngineView*, const QPoint&);
Expand Down Expand Up @@ -481,8 +482,6 @@ static bool qt6webengine(const Window winId, const double scaleFactor, const cha
return true;
}

END_NAMESPACE_DISTRHO

// -----------------------------------------------------------------------------------------------------------
// startup via ld-linux

Expand All @@ -493,28 +492,27 @@ static void signalHandler(const int sig)
reloadFn();
}

DISTRHO_PLUGIN_EXPORT
void _start()
int dpf_webview_start(int /* argc */, char** /* argv[] */)
{
uselocale(newlocale(LC_NUMERIC_MASK, "C", nullptr));

const char* const envPort = std::getenv("DPF_WEBVIEW_PORT");
DISTRHO_SAFE_ASSERT_RETURN(envPort != nullptr, exit(1));
DISTRHO_SAFE_ASSERT_RETURN(envPort != nullptr, 1);

const char* const envScaleFactor = std::getenv("DPF_WEBVIEW_SCALE_FACTOR");
DISTRHO_SAFE_ASSERT_RETURN(envScaleFactor != nullptr, exit(1));
DISTRHO_SAFE_ASSERT_RETURN(envScaleFactor != nullptr, 1);

const char* const envWinId = std::getenv("DPF_WEBVIEW_WIN_ID");
DISTRHO_SAFE_ASSERT_RETURN(envWinId != nullptr, exit(1));
DISTRHO_SAFE_ASSERT_RETURN(envWinId != nullptr, 1);

const Window winId = std::strtoul(envWinId, nullptr, 10);
DISTRHO_SAFE_ASSERT_RETURN(winId != 0, exit(1));
DISTRHO_SAFE_ASSERT_RETURN(winId != 0, 1);

const double scaleFactor = std::atof(envScaleFactor);
DISTRHO_SAFE_ASSERT_RETURN(scaleFactor > 0.0, exit(1));
DISTRHO_SAFE_ASSERT_RETURN(scaleFactor > 0.0, 1);

Display* const display = XOpenDisplay(nullptr);
DISTRHO_SAFE_ASSERT_RETURN(display != nullptr, exit(1));
DISTRHO_SAFE_ASSERT_RETURN(display != nullptr, 1);

char url[32] = {};
std::snprintf(url, 31, "http://127.0.0.1:%s/", envPort);
Expand All @@ -531,7 +529,9 @@ void _start()

XCloseDisplay(display);

exit(0);
return 0;
}

// -----------------------------------------------------------------------------------------------------------

END_NAMESPACE_DISTRHO

0 comments on commit 818ee74

Please sign in to comment.