XEmbedComponent and choc webview

I’m attempting to show a webview in a Linux application using XEmbedComponent and the choc webview. I’ve gleaned its usage from the docs, a sample plugin, and Jules’ cmajor implementation that he’s referenced in the forum. These use different ways to embed the choc webview into the XEmbedComponent (the plugin uses getViewHandle() as the window id, while the cmajor code uses gtk_plug_get_id()), but both methods have the same result - a window with black content. The corresponding method on Mac OS using NSViewComponent works great, but only shows black on Linux (Ubuntu 22.04). The code essentially comes down to (within the parent Component constructor):

    choc::ui::WebView::Options options;
    options.enableDebugMode = true;
    fChocWebView = std::make_unique<choc::ui::WebView>(options);
#if JUCE_MAC
    fEmbedView = std::make_unique<juce::NSViewComponent>();
    fEmbedView->setView(fChocWebView->getViewHandle());
#elif JUCE_LINUX
    //fEmbedView = std::make_unique<juce::XEmbedComponent>(getWindowID(*fChocWebView), true, false);
    fEmbedView = std::make_unique<juce::XEmbedComponent>(fChocWebView->getViewHandle());
#endif
    addAndMakeVisible(fEmbedView.get());
    fChocWebView->navigate("https://somewebsite.com/");

Any insight would be appreciated.

Did you ever manage to solve this issue?

I’m running into similar:

Ubuntu 22.04.4 LTS
BitWig 5.1.6 shows a black plugin window.
Reaper 7.14 shows the Dev Tools, a corrupted add plugin window and completely locks up.

Unfortunately, no. We put a pause on the work and are anxiously awaiting JUCE 8 with all the new webview goodness…

2 Likes

I had a small bit of “success” with the following taken from the CMajor example:

auto childWidget = GTK_WIDGET (webView->getViewHandle());  // webView is a std::unique_ptr<choc::ui::WebView>
auto plug = gtk_plug_new (0);
gtk_container_add (GTK_CONTAINER (plug), childWidget);
gtk_widget_show_all (plug);
auto wid =  gtk_plug_get_id (GTK_PLUG (plug));
viewContainer = std::make_unique<juce::XEmbedComponent>(wid);

the web page actually shows up in Reaper now, however the rest of the window is fairly messed up, but worse it still completely locks up Reaper. :frowning:
In Bitwig it’s the same story: black window.

I can’t quite believe there are examples of this that must work, yet we’re stuck somehow, even (in theory) doing the same thing…