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") add_subdirectory("examples/CairoUI")
endif() endif()
endif() endif()
add_subdirectory("examples/ExternalUI")
if((NOT WIN32) AND (NOT APPLE))
add_subdirectory("examples/ExternalUI")
endif()
add_subdirectory("examples/EmbedExternalUI") add_subdirectory("examples/EmbedExternalUI")
add_subdirectory("examples/FileHandling") add_subdirectory("examples/FileHandling")
add_subdirectory("examples/Info") 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 FILES_UI
EmbedExternalExampleUI.cpp) EmbedExternalExampleUI.cpp)


target_include_directories(d_embed_external_ui PUBLIC ".")

if (APPLE) if (APPLE)
find_library(APPLE_COCOA_FRAMEWORK "Cocoa")
target_compile_options(d_embed_external_ui PUBLIC "-ObjC++") target_compile_options(d_embed_external_ui PUBLIC "-ObjC++")
target_link_libraries(d_embed_external_ui PUBLIC "${APPLE_COCOA_FRAMEWORK}")
endif () 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: public:
ExternalExampleUI() ExternalExampleUI()
: UI(405, 256), : UI(405, 256),
#ifdef KDE_FIFO_TEST
#ifdef KDE_FIFO_TEST
fFifo(-1), fFifo(-1),
fExternalScript(getNextBundlePath()), fExternalScript(getNextBundlePath()),
#endif
#endif
fValue(0.0f) fValue(0.0f)
{ {
#ifdef KDE_FIFO_TEST
#ifdef KDE_FIFO_TEST
if (fExternalScript.isEmpty()) if (fExternalScript.isEmpty())
{ {
fExternalScript = getCurrentPluginFilename(); fExternalScript = getCurrentPluginFilename();
@@ -88,7 +88,8 @@ public:


fExternalScript += "/ExternalLauncher.sh"; fExternalScript += "/ExternalLauncher.sh";
d_stdout("External script = %s", fExternalScript.buffer()); d_stdout("External script = %s", fExternalScript.buffer());
#endif
#endif

if (isVisible() || isEmbed()) if (isVisible() || isEmbed())
visibilityChanged(true); visibilityChanged(true);
} }
@@ -114,7 +115,7 @@ protected:


fValue = value; fValue = value;


#ifdef KDE_FIFO_TEST
#ifdef KDE_FIFO_TEST
if (fFifo == -1) if (fFifo == -1)
return; return;


@@ -124,7 +125,7 @@ protected:
std::snprintf(valueStr, 23, "%i\n", static_cast<int>(value + 0.5f)); std::snprintf(valueStr, 23, "%i\n", static_cast<int>(value + 0.5f));


DISTRHO_SAFE_ASSERT(writeRetry(fFifo, valueStr, 24) == sizeof(valueStr)); DISTRHO_SAFE_ASSERT(writeRetry(fFifo, valueStr, 24) == sizeof(valueStr));
#endif
#endif
} }


/* -------------------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------------------
@@ -135,12 +136,12 @@ protected:
*/ */
void uiIdle() override void uiIdle() override
{ {
#ifdef KDE_FIFO_TEST
#ifdef KDE_FIFO_TEST
if (fFifo == -1) if (fFifo == -1)
return; return;


writeRetry(fFifo, "idle\n", 5); writeRetry(fFifo, "idle\n", 5);
#endif
#endif
} }


/** /**
@@ -148,7 +149,7 @@ protected:
*/ */
void visibilityChanged(const bool visible) override void visibilityChanged(const bool visible) override
{ {
#ifdef KDE_FIFO_TEST
#ifdef KDE_FIFO_TEST
if (visible) if (visible)
{ {
DISTRHO_SAFE_ASSERT_RETURN(fileExists(fExternalScript),); DISTRHO_SAFE_ASSERT_RETURN(fileExists(fExternalScript),);
@@ -191,8 +192,8 @@ protected:
unlink(kFifoFilename); unlink(kFifoFilename);
terminateAndWaitForExternalProcess(); terminateAndWaitForExternalProcess();
} }
#endif
#ifdef MPV_TEST
#endif
#ifdef MPV_TEST
if (visible) if (visible)
{ {
const char* const file = "/home/falktx/Videos/HD/"; // TODO make this a state file? const char* const file = "/home/falktx/Videos/HD/"; // TODO make this a state file?
@@ -226,19 +227,19 @@ protected:
{ {
terminateAndWaitForExternalProcess(); terminateAndWaitForExternalProcess();
} }
#endif
#endif
} }


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


private: private:
#ifdef KDE_FIFO_TEST
#ifdef KDE_FIFO_TEST
// IPC Stuff // IPC Stuff
int fFifo; int fFifo;


// Path to external ui script // Path to external ui script
String fExternalScript; String fExternalScript;
#endif
#endif


// Current value, cached for when UI becomes visible // Current value, cached for when UI becomes visible
float fValue; float fValue;


+ 1
- 1
examples/ExternalUI/Makefile View File

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


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




Loading…
Cancel
Save