Skip to content

Commit 5c6c5ba

Browse files
committed
Add argc,argv constructor to Application for use with webviews
Signed-off-by: falkTX <falktx@falktx.com>
1 parent 480aa7b commit 5c6c5ba

File tree

2 files changed

+68
-4
lines changed

2 files changed

+68
-4
lines changed

dgl/Application.hpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* DISTRHO Plugin Framework (DPF)
3-
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
3+
* Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com>
44
*
55
* Permission to use, copy, modify, and/or distribute this software for any purpose with
66
* 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)
5454
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_file_browser_off)
5555
#endif
5656

57+
#ifdef DGL_USE_WEB_VIEW
58+
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_on)
59+
#else
60+
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_off)
61+
#endif
62+
5763
#ifdef DGL_NO_SHARED_RESOURCES
5864
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_no_shared_resources_on)
5965
#else
@@ -78,11 +84,16 @@ class DISTRHO_API Application
7884
{
7985
public:
8086
/**
81-
Constructor.
87+
Constructor for standalone or plugin application.
8288
*/
83-
// NOTE: the default value is not yet passed, so we catch where we use this
8489
Application(bool isStandalone = true);
8590

91+
/**
92+
Constructor for a standalone application.
93+
This specific constructor is required if using web views in standalone applications.
94+
*/
95+
Application(int argc, char* argv[]);
96+
8697
/**
8798
Destructor.
8899
*/

dgl/src/Application.cpp

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* DISTRHO Plugin Framework (DPF)
3-
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
3+
* Copyright (C) 2012-2025 Filipe Coelho <falktx@falktx.com>
44
*
55
* Permission to use, copy, modify, and/or distribute this software for any purpose with
66
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -24,6 +24,11 @@
2424

2525
START_NAMESPACE_DGL
2626

27+
/* define webview start */
28+
#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && defined(DGL_USE_WEB_VIEW)
29+
int dpf_webview_start(int argc, char* argv[]);
30+
#endif
31+
2732
// --------------------------------------------------------------------------------------------------------------------
2833
// build config sentinels
2934

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

50+
#ifdef DGL_USE_WEB_VIEW
51+
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_on)
52+
#else
53+
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_use_web_view_off)
54+
#endif
55+
4556
#ifdef DGL_NO_SHARED_RESOURCES
4657
BUILD_CONFIG_SENTINEL(fail_to_link_is_mismatch_dgl_no_shared_resources_on)
4758
#else
@@ -64,6 +75,11 @@ bool dpf_check_build_status() noexcept
6475
#else
6576
fail_to_link_is_mismatch_dgl_use_file_browser_off.ok &&
6677
#endif
78+
#ifdef DGL_USE_WEB_VIEW
79+
fail_to_link_is_mismatch_dgl_use_web_view_on.ok &&
80+
#else
81+
fail_to_link_is_mismatch_dgl_use_web_view_off.ok &&
82+
#endif
6783
#ifdef DGL_NO_SHARED_RESOURCES
6884
fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok &&
6985
#else
@@ -96,6 +112,43 @@ Application::Application(const bool isStandalone)
96112
#else
97113
fail_to_link_is_mismatch_dgl_use_file_browser_off.ok = true;
98114
#endif
115+
#ifdef DGL_USE_WEB_VIEW
116+
fail_to_link_is_mismatch_dgl_use_web_view_on.ok = true;
117+
#else
118+
fail_to_link_is_mismatch_dgl_use_web_view_off.ok = true;
119+
#endif
120+
#ifdef DGL_NO_SHARED_RESOURCES
121+
fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok = true;
122+
#else
123+
fail_to_link_is_mismatch_dgl_no_shared_resources_off.ok = true;
124+
#endif
125+
DISTRHO_SAFE_ASSERT(dpf_check_build_status());
126+
}
127+
128+
Application::Application(int argc, char* argv[])
129+
: pData(new PrivateData(true))
130+
{
131+
#if defined(HAVE_X11) && defined(DISTRHO_OS_LINUX) && defined(DGL_USE_WEB_VIEW)
132+
if (argc >= 2 && std::strcmp(argv[1], "dpf-ld-linux-webview") == 0)
133+
std::exit(dpf_webview_start(argc, argv));
134+
#endif
135+
136+
// build config sentinels
137+
#ifdef DPF_DEBUG
138+
fail_to_link_is_mismatch_dpf_debug_on.ok = true;
139+
#else
140+
fail_to_link_is_mismatch_dpf_debug_off.ok = true;
141+
#endif
142+
#ifdef DGL_USE_FILE_BROWSER
143+
fail_to_link_is_mismatch_dgl_use_file_browser_on.ok = true;
144+
#else
145+
fail_to_link_is_mismatch_dgl_use_file_browser_off.ok = true;
146+
#endif
147+
#ifdef DGL_USE_WEB_VIEW
148+
fail_to_link_is_mismatch_dgl_use_web_view_on.ok = true;
149+
#else
150+
fail_to_link_is_mismatch_dgl_use_web_view_off.ok = true;
151+
#endif
99152
#ifdef DGL_NO_SHARED_RESOURCES
100153
fail_to_link_is_mismatch_dgl_no_shared_resources_on.ok = true;
101154
#else

0 commit comments

Comments
 (0)