From fa9854bdc382f9837985f26d7ed65953caadc78a Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 16 Mar 2024 12:13:51 +0100 Subject: [PATCH] ship plugin for linux, fix for repeated value changes Signed-off-by: falkTX --- src/DPF | 2 +- src/plugin/DesktopUI.cpp | 29 ++++++++++++++++++++--------- src/plugin/Makefile | 2 +- src/plugin/WebViewX11.cpp | 5 ++++- utils/linux/linux-tar.sh | 3 ++- utils/win64/win64-installer.iss | 8 ++++---- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/DPF b/src/DPF index 5507f92..9f4fcf9 160000 --- a/src/DPF +++ b/src/DPF @@ -1 +1 @@ -Subproject commit 5507f926306a5bd6d75e50e561d04ea960b739b4 +Subproject commit 9f4fcf9dda1076aec061e740de3f33ca90fa495a diff --git a/src/plugin/DesktopUI.cpp b/src/plugin/DesktopUI.cpp index a5580b7..1e5ab51 100644 --- a/src/plugin/DesktopUI.cpp +++ b/src/plugin/DesktopUI.cpp @@ -21,7 +21,7 @@ class DesktopUI : public UI, String label; String error; String errorDetail; - uint port = 0; + int port = 0; void* webview = nullptr; public: @@ -93,6 +93,14 @@ class DesktopUI : public UI, if (value < 0.f) { + const int nport = d_roundToIntNegative(value); + DISTRHO_SAFE_ASSERT_RETURN(nport != 0,); + + if (nport == port) + return; + + port = nport; + if (webview != nullptr) { destroyWebView(webview); @@ -100,7 +108,7 @@ class DesktopUI : public UI, buttonOpenWebGui.hide(); } - switch (-d_roundToIntNegative(value)) + switch (-nport) { case kErrorAppDirNotFound: error = "Error: MOD Desktop application directory not found"; @@ -128,6 +136,12 @@ class DesktopUI : public UI, return; } + const int nport = d_roundToUnsignedInt(value); + DISTRHO_SAFE_ASSERT_RETURN(nport != 0,); + + if (nport == port) + return; + if (error.isNotEmpty()) { error.clear(); @@ -144,12 +158,9 @@ class DesktopUI : public UI, repaint(); } - port = d_roundToUnsignedInt(value); - DISTRHO_SAFE_ASSERT_RETURN(port != 0,); - - port += kPortNumOffset; - d_stderr("webview port is %d", port); - webview = addWebView(getWindow().getNativeWindowHandle(), getScaleFactor(), port); + port = nport; + d_stderr("webview port is %d", port + kPortNumOffset); + webview = addWebView(getWindow().getNativeWindowHandle(), getScaleFactor(), port + kPortNumOffset); buttonOpenWebGui.show(); repaint(); @@ -205,7 +216,7 @@ class DesktopUI : public UI, openUserFilesDir(); break; case 3: - openWebGui(port); + openWebGui(port + kPortNumOffset); break; } } diff --git a/src/plugin/Makefile b/src/plugin/Makefile index 0ef829f..5b448a1 100644 --- a/src/plugin/Makefile +++ b/src/plugin/Makefile @@ -9,7 +9,7 @@ include ../DPF/Makefile.base.mk # --------------------------------------------------------------------------------------------------------------------- # Project name, used for binaries -NAME = MOD-Desktop +NAME = mod-desktop # --------------------------------------------------------------------------------------------------------------------- # Files to build diff --git a/src/plugin/WebViewX11.cpp b/src/plugin/WebViewX11.cpp index d785865..61e3d57 100644 --- a/src/plugin/WebViewX11.cpp +++ b/src/plugin/WebViewX11.cpp @@ -57,7 +57,10 @@ void* addWebView(const uintptr_t parentWinId, const double scaleFactor, const ui std::strncpy(ldlinux, info.dli_fname, PATH_MAX - 1); } } + const char* const filename = getBinaryFilename(); + d_stdout("ld-linux is '%s'", ldlinux); + d_stdout("filename is '%s'", filename); ::Display* const display = XOpenDisplay(nullptr); DISTRHO_SAFE_ASSERT_RETURN(display != nullptr, nullptr); @@ -85,7 +88,7 @@ void* addWebView(const uintptr_t parentWinId, const double scaleFactor, const ui ipc->childWindow = 0; ipc->ourWindow = parentWinId; - const char* const args[] = { ldlinux, getBinaryFilename(), nullptr }; + const char* const args[] = { ldlinux, filename, nullptr }; ipc->p.start(args, envp); for (uint i = 0; envp[i] != nullptr; ++i) diff --git a/utils/linux/linux-tar.sh b/utils/linux/linux-tar.sh index 1142143..fa6fd13 100755 --- a/utils/linux/linux-tar.sh +++ b/utils/linux/linux-tar.sh @@ -16,7 +16,8 @@ rm -rf mod-ui/modtools/__pycache__ ARCH=$(uname -m) VERSION="$(cat VERSION)" -mkdir mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX} +mkdir -p mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/plugin-variants mv build mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/mod-desktop cp utils/linux/mod-desktop.* mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/ +cp -r build-plugin/*.* mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}/plugin-variants/ tar chJf mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX}.tar.xz mod-desktop-${VERSION}-linux-${ARCH}${SUFFIX} diff --git a/utils/win64/win64-installer.iss b/utils/win64/win64-installer.iss index 6739117..03edafb 100644 --- a/utils/win64/win64-installer.iss +++ b/utils/win64/win64-installer.iss @@ -161,10 +161,10 @@ Source: "..\..\build\mod-desktop-asio.dll"; DestDir: "{win}\System32"; Flags: ig Source: "..\..\build\mod-hardware-descriptor.json"; DestDir: "{app}"; Flags: ignoreversion; Source: "..\..\build\VERSION"; DestDir: "{app}"; Flags: ignoreversion; ; plugin variants -Source: "..\..\build-plugin\MOD-Desktop.clap"; DestDir: "{commoncf64}\CLAP"; Components: clap; Flags: ignoreversion; -Source: "..\..\build-plugin\MOD-Desktop.lv2\*.*"; DestDir: "{commoncf64}\LV2\MOD-Desktop.lv2"; Components: lv2; Flags: ignoreversion; -Source: "..\..\build-plugin\MOD-Desktop-vst.dll"; DestDir: "{code:GetVST2Dir}\"; Components: vst2; Flags: ignoreversion; -Source: "..\..\build-plugin\MOD-Desktop.vst3\Contents\x86_64-win\*.*"; DestDir: "{commoncf64}\VST3\MOD-Desktop.vst3\Contents\x86_64-win"; Components: vst3; Flags: ignoreversion; +Source: "..\..\build-plugin\mod-desktop.clap"; DestDir: "{commoncf64}\CLAP"; Components: clap; Flags: ignoreversion; +Source: "..\..\build-plugin\mod-desktop.lv2\*.*"; DestDir: "{commoncf64}\LV2\mod-desktop.lv2"; Components: lv2; Flags: ignoreversion; +Source: "..\..\build-plugin\mod-desktop-vst.dll"; DestDir: "{code:GetVST2Dir}\"; Components: vst2; Flags: ignoreversion; +Source: "..\..\build-plugin\mod-desktop.vst3\Contents\x86_64-win\*.*"; DestDir: "{commoncf64}\VST3\mod-desktop.vst3\Contents\x86_64-win"; Components: vst3; Flags: ignoreversion; ; pedalboards #include "win64-pedalboards.iss" ; plugins