Browse Source

Add argc,argv constructor to Application for use with webviews

Signed-off-by: falkTX <falktx@falktx.com>
popup-tests
falkTX 1 month ago
parent
commit
5c6c5ba048
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 68 additions and 4 deletions
  1. +14
    -3
      dgl/Application.hpp
  2. +54
    -1
      dgl/src/Application.cpp

+ 14
- 3
dgl/Application.hpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this * or without fee is hereby granted, provided that the above copyright notice and this
@@ -54,6 +54,12 @@ BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_file_browser_on)
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_file_browser_off) BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_file_browser_off)
#endif #endif


#ifdef DGL_USE_WEB_VIEW
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_on)
#else
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_off)
#endif

#ifdef DGL_NO_SHARED_RESOURCES #ifdef DGL_NO_SHARED_RESOURCES
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_no_shared_resources_on) BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_no_shared_resources_on)
#else #else
@@ -78,11 +84,16 @@ class DISTRHO_API Application
{ {
public: public:
/** /**
Constructor.
Constructor for standalone or plugin application.
*/ */
// NOTE: the default value is not yet passed, so we catch where we use this
Application(bool isStandalone = true); Application(bool isStandalone = true);


/**
Constructor for a standalone application.
This specific constructor is required if using web views in standalone applications.
*/
Application(int argc, char* argv[]);

/** /**
Destructor. Destructor.
*/ */


+ 54
- 1
dgl/src/Application.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this * or without fee is hereby granted, provided that the above copyright notice and this
@@ -24,6 +24,11 @@


START_NAMESPACE_DGL START_NAMESPACE_DGL


/* define webview start */
#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && defined(DGL_USE_WEB_VIEW)
int dpf_webview_start(int argc, char* argv[]);
#endif

// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// build config sentinels // build config sentinels


@@ -42,6 +47,12 @@ BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_file_browser_on)
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_file_browser_off) BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_file_browser_off)
#endif #endif


#ifdef DGL_USE_WEB_VIEW
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_on)
#else
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_off)
#endif

#ifdef DGL_NO_SHARED_RESOURCES #ifdef DGL_NO_SHARED_RESOURCES
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_no_shared_resources_on) BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_no_shared_resources_on)
#else #else
@@ -64,6 +75,11 @@ bool dpf_check_build_status() noexcept
#else #else
fail_to_link_is_mismatch_dgl_use_file_browser_off.ok && fail_to_link_is_mismatch_dgl_use_file_browser_off.ok &&
#endif #endif
#ifdef DGL_USE_WEB_VIEW
fail_to_link_is_mismatch_dgl_use_web_view_on.ok &&
#else
fail_to_link_is_mismatch_dgl_use_web_view_off.ok &&
#endif
#ifdef DGL_NO_SHARED_RESOURCES #ifdef DGL_NO_SHARED_RESOURCES
fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok && fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok &&
#else #else
@@ -96,6 +112,43 @@ Application::Application(const bool isStandalone)
#else #else
fail_to_link_is_mismatch_dgl_use_file_browser_off.ok = true; fail_to_link_is_mismatch_dgl_use_file_browser_off.ok = true;
#endif #endif
#ifdef DGL_USE_WEB_VIEW
fail_to_link_is_mismatch_dgl_use_web_view_on.ok = true;
#else
fail_to_link_is_mismatch_dgl_use_web_view_off.ok = true;
#endif
#ifdef DGL_NO_SHARED_RESOURCES
fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok = true;
#else
fail_to_link_is_mismatch_dgl_no_shared_resources_off.ok = true;
#endif
DISTRHO_SAFE_ASSERT(dpf_check_build_status());
}

Application::Application(int argc, char* argv[])
: pData(new PrivateData(true))
{
#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && defined(DGL_USE_WEB_VIEW)
if (argc >= 2 && std::strcmp(argv[1], "dpf-ld-linux-webview") == 0)
std::exit(dpf_webview_start(argc, argv));
#endif

// build config sentinels
#ifdef DPF_DEBUG
fail_to_link_is_mismatch_dpf_debug_on.ok = true;
#else
fail_to_link_is_mismatch_dpf_debug_off.ok = true;
#endif
#ifdef DGL_USE_FILE_BROWSER
fail_to_link_is_mismatch_dgl_use_file_browser_on.ok = true;
#else
fail_to_link_is_mismatch_dgl_use_file_browser_off.ok = true;
#endif
#ifdef DGL_USE_WEB_VIEW
fail_to_link_is_mismatch_dgl_use_web_view_on.ok = true;
#else
fail_to_link_is_mismatch_dgl_use_web_view_off.ok = true;
#endif
#ifdef DGL_NO_SHARED_RESOURCES #ifdef DGL_NO_SHARED_RESOURCES
fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok = true; fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok = true;
#else #else


Loading…
Cancel
Save