Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach to a parent window? #283

Open
adam-hanna opened this issue May 6, 2021 · 7 comments
Open

Attach to a parent window? #283

adam-hanna opened this issue May 6, 2021 · 7 comments

Comments

@adam-hanna
Copy link

adam-hanna commented May 6, 2021

In the audio production world, developers can build VST plugins. These plugins can have GUI's but need to attach the GUI to an externally managed window.

Is it possible to add a feature to this library to allow such functionality?

For example, here's a rust crate for vst gui's that opens a web view and attaches it to a parent window:
https://github.com/vanderlokken/rust-vst-gui/blob/c71ca8df17bbfb2b109aa72ffc05bbf56e3aeadd/src/lib.rs#L56

Here's the maintaners thoughts on using this library for cross-browser support:
vanderlokken/rust-vst-gui#8 (comment)

EDIT
ACK! This has already been mentioned in the Readme! So Sorry!

@Boscop
Copy link
Owner

Boscop commented May 8, 2021

I'm reopening this because we don't have a ticket for this yet..
It's probably possible but I'm not sure how.
@vanderlokken: Would it be possible the same way as in https://github.com/vanderlokken/rust-vst-gui?

@Boscop Boscop reopened this May 8, 2021
@pythoneer
Copy link

pythoneer commented May 8, 2021

Just to add on usecases. I have an "old" application in Qt with two QtWebViews managed by that application – its basically just a convenience for managing two browser windows for the user for managing multiple accounts etc. But maintaining and deploying this application for Linux/macOS/Win is quite labor intense(Qt by itself and the Webview with openssl dependencies etc.) and i would love to replace it with something like fltk-rs and two embedded web-views. Would love if this could work like the embedded VLC example as an additional inspiration.

@adam-hanna
Copy link
Author

Also adding @mikesoylu to the thread who may be able to provide comment (he forked @vanderlokken's code to work with MacOS).

https://github.com/mikesoylu/rust-vst-gui

@pythoneer
Copy link

pythoneer commented May 8, 2021

If i am not fully mistaken the underlying c-lib should already support that, no?

https://raw.githubusercontent.com/zserge/webview/master/webview.h

// Creates a new webview instance. If debug is non-zero - developer tools will
// be enabled (if the platform supports them). Window parameter can be a
// pointer to the native window handle. If it's non-null - then child WebView
// is embedded into the given parent window. Otherwise a new window is created.
// Depending on the platform, a GtkWindow, NSWindow or HWND pointer can be
// passed here.
WEBVIEW_API webview_t webview_create(int debug, void *window);

i tried digging through the code a little bit with webview_sys and wondering why this is so different from webview.h different version or handmade wrapper?

EDIT:
oh ... is https://github.com/Boscop/web-view/tree/master/webview-sys a fork/reimplementation of https://github.com/webview/webview and not a "generated" binding that tracks webview and the implementations have diverged?

EDIT2:
yeah its say in the Readme:
This library provides a Rust binding to the original implementation of webview, ...

and this https://github.com/webview/webview/blob/0.1.0/webview.h looks quite similar to the current implementation of webview_sys that does not have the same API as the example i showed above. There was a major refactoring it looks like.

@mikesoylu
Copy link

Hi was able to do it with cocoa(just for some apple specific stuff) and webview-sys. Relevant code can be found here in the fork: mikesoylu/rust-vst-gui@3b56730#diff-7ea3d8f419ddb71f86b7e524c1c7025cf92f1b46ad6457e505795209408f67f1

@lucianoiam
Copy link

I've done this but for a C++ plugins framework here. I don't know Rust but it should be possible to extract the webview classes and write a wrapper. The classes were written from scratch with all the plugin specifics in mind: no statics, no link to GUI toolkits, etc.

This reverb plugin has a webview based UI.

@SkyLeite
Copy link

Hi! Any updates on this? It would be extremely helpful for writing UI in games :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants