commit 51bcd7bad4b5d0f8fde60238dfa2d65eecd73c8c
parent 24fe04fcbdb2b07d550ca6784e0d03bfaf1957d3
Author: falkTX <falktx@falktx.com>
Date: Thu, 29 Dec 2022 00:46:19 +0000
External UI related fixes
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
4 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -47,7 +47,9 @@ if(DPF_EXAMPLES)
add_subdirectory("examples/CairoUI")
endif()
endif()
- add_subdirectory("examples/ExternalUI")
+ if((NOT WIN32) AND (NOT APPLE))
+ add_subdirectory("examples/ExternalUI")
+ endif()
add_subdirectory("examples/EmbedExternalUI")
add_subdirectory("examples/FileHandling")
add_subdirectory("examples/Info")
diff --git a/examples/EmbedExternalUI/CMakeLists.txt b/examples/EmbedExternalUI/CMakeLists.txt
@@ -9,9 +9,10 @@ dpf_add_plugin(d_embed_external_ui
FILES_UI
EmbedExternalExampleUI.cpp)
+target_include_directories(d_embed_external_ui PUBLIC ".")
+
if (APPLE)
+find_library(APPLE_COCOA_FRAMEWORK "Cocoa")
target_compile_options(d_embed_external_ui PUBLIC "-ObjC++")
+target_link_libraries(d_embed_external_ui PUBLIC "${APPLE_COCOA_FRAMEWORK}")
endif ()
-
-target_include_directories(
- d_embed_external_ui PUBLIC ".")
diff --git a/examples/ExternalUI/ExternalExampleUI.cpp b/examples/ExternalUI/ExternalExampleUI.cpp
@@ -73,13 +73,13 @@ class ExternalExampleUI : public UI
public:
ExternalExampleUI()
: UI(405, 256),
-#ifdef KDE_FIFO_TEST
+ #ifdef KDE_FIFO_TEST
fFifo(-1),
fExternalScript(getNextBundlePath()),
-#endif
+ #endif
fValue(0.0f)
{
-#ifdef KDE_FIFO_TEST
+ #ifdef KDE_FIFO_TEST
if (fExternalScript.isEmpty())
{
fExternalScript = getCurrentPluginFilename();
@@ -88,7 +88,8 @@ public:
fExternalScript += "/ExternalLauncher.sh";
d_stdout("External script = %s", fExternalScript.buffer());
-#endif
+ #endif
+
if (isVisible() || isEmbed())
visibilityChanged(true);
}
@@ -114,7 +115,7 @@ protected:
fValue = value;
-#ifdef KDE_FIFO_TEST
+ #ifdef KDE_FIFO_TEST
if (fFifo == -1)
return;
@@ -124,7 +125,7 @@ protected:
std::snprintf(valueStr, 23, "%i\n", static_cast<int>(value + 0.5f));
DISTRHO_SAFE_ASSERT(writeRetry(fFifo, valueStr, 24) == sizeof(valueStr));
-#endif
+ #endif
}
/* --------------------------------------------------------------------------------------------------------
@@ -135,12 +136,12 @@ protected:
*/
void uiIdle() override
{
-#ifdef KDE_FIFO_TEST
+ #ifdef KDE_FIFO_TEST
if (fFifo == -1)
return;
writeRetry(fFifo, "idle\n", 5);
-#endif
+ #endif
}
/**
@@ -148,7 +149,7 @@ protected:
*/
void visibilityChanged(const bool visible) override
{
-#ifdef KDE_FIFO_TEST
+ #ifdef KDE_FIFO_TEST
if (visible)
{
DISTRHO_SAFE_ASSERT_RETURN(fileExists(fExternalScript),);
@@ -191,8 +192,8 @@ protected:
unlink(kFifoFilename);
terminateAndWaitForExternalProcess();
}
-#endif
-#ifdef MPV_TEST
+ #endif
+ #ifdef MPV_TEST
if (visible)
{
const char* const file = "/home/falktx/Videos/HD/"; // TODO make this a state file?
@@ -226,19 +227,19 @@ protected:
{
terminateAndWaitForExternalProcess();
}
-#endif
+ #endif
}
// -------------------------------------------------------------------------------------------------------
private:
-#ifdef KDE_FIFO_TEST
+ #ifdef KDE_FIFO_TEST
// IPC Stuff
int fFifo;
// Path to external ui script
String fExternalScript;
-#endif
+ #endif
// Current value, cached for when UI becomes visible
float fValue;
diff --git a/examples/ExternalUI/Makefile b/examples/ExternalUI/Makefile
@@ -24,7 +24,7 @@ FILES_UI = \
UI_TYPE = external
include ../../Makefile.plugins.mk
-ifneq ($(HAIKU),true)
+ifneq ($(MACOS)$(HAIKU),true)
LINK_FLAGS += -ldl
endif