Skip to content

Commit

Permalink
Setup IPC through shared mem for linux web ui
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed May 8, 2024
1 parent 248456f commit fe99f0d
Show file tree
Hide file tree
Showing 7 changed files with 447 additions and 78 deletions.
4 changes: 3 additions & 1 deletion dgl/Web.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ START_NAMESPACE_DGL
// --------------------------------------------------------------------------------------------------------------------
// WebViewWidget

class WebViewWidget : public TopLevelWidget
class WebViewWidget : public TopLevelWidget,
private IdleCallback
{
public:
/**
Expand All @@ -59,6 +60,7 @@ class WebViewWidget : public TopLevelWidget

private:
const DISTRHO_NAMESPACE::WebViewHandle webview;
void idleCallback() override;
void onDisplay() override {}

// TODO inside private data
Expand Down
10 changes: 10 additions & 0 deletions dgl/src/Web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ WebViewWidget::WebViewWidget(Window& windowToMapTo)
windowToMapTo.getScaleFactor(),
WebViewOptions(_on_msg, this)))
{
if (webview != nullptr)
addIdleCallback(this, 1000 / 60);
}

WebViewWidget::~WebViewWidget()
{
if (webview != nullptr)
{
removeIdleCallback(this);
webViewDestroy(webview);
}
}

void WebViewWidget::evaluateJS(const char* const js)
Expand Down Expand Up @@ -73,6 +78,11 @@ void WebViewWidget::onResize(const ResizeEvent& ev)
webViewResize(webview, ev.size.getWidth(), ev.size.getHeight(), getScaleFactor());
}

void WebViewWidget::idleCallback()
{
webViewIdle(webview);
}

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

static void notImplemented(const char* const name)
Expand Down
Loading

0 comments on commit fe99f0d

Please sign in to comment.