Browse Source

External UI related fixes

Signed-off-by: falkTX <falktx@falktx.com>
pull/397/head
falkTX 2 years ago
parent
commit
51bcd7bad4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 23 additions and 19 deletions
  1. +3
    -1
      CMakeLists.txt
  2. +4
    -3
      examples/EmbedExternalUI/CMakeLists.txt
  3. +15
    -14
      examples/ExternalUI/ExternalExampleUI.cpp
  4. +1
    -1
      examples/ExternalUI/Makefile

+ 3
- 1
CMakeLists.txt View File

@@ -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")


+ 4
- 3
examples/EmbedExternalUI/CMakeLists.txt View File

@@ -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 ".")

+ 15
- 14
examples/ExternalUI/ExternalExampleUI.cpp View File

@@ -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;


+ 1
- 1
examples/ExternalUI/Makefile View File

@@ -24,7 +24,7 @@ FILES_UI = \
UI_TYPE = external
include ../../Makefile.plugins.mk

ifneq ($(HAIKU),true)
ifneq ($(MACOS)$(HAIKU),true)
LINK_FLAGS += -ldl
endif



Loading…
Cancel
Save