web-view icon indicating copy to clipboard operation
web-view copied to clipboard

Embedding into existing app

Open inikulin opened this issue 5 years ago • 4 comments

Hi, first of all - thank you for the amazing project.

In my use scenario I'd like to embed web-view into existing C++ desktop app. E.g. C++ app will call extern Rust function and pass HWND or NSView to it and it will run my lib's Rust business logic and embed web-view into the window for which handlers was provided.

From my quick examination of the code it seems like it's possible to implement that. Do you have any plans supporting this functionality? I'm willing to help with a PR, but I'll probably will need some help from your side: I'm not familiar with cocoa at all and it would be great if you point me in the right direction with it.

inikulin avatar Dec 30 '19 15:12 inikulin

I do have plans to add this functionality, no concrete implementation yet, but I am looking into how this could be implemented.

The best solution for you would probably be to use the original zserge/webview on branch webview-x which this library is based on as it already has the functionality you want (by passing HWND or NSView I think) and is also written in C/C++/Objective-C which would probably fit more easily into your C++ desktop app.

richardhozak avatar Dec 30 '19 19:12 richardhozak

For the people that would be interested in implementing this, it could be implemented here in Rust with either of those:

  • custom windowing + raw-window-handle crate
  • winit + raw-window-handle crate
  • druid-shell + custom window handle
  • completely custom solution

richardhozak avatar Dec 30 '19 19:12 richardhozak

Thanks @zxey

written in C/C++/Objective-C which would probably fit more easily into your C++ desktop app.

The thing is that I'd prefer to use Rust for the backend code, the host application is implemented in C++. So, I'd rather stick with this crate.

inikulin avatar Dec 30 '19 20:12 inikulin

Something we are currently working on at tauri is enabling you to sideload other binaries (bundled in the monolith) which then can communicate with rust and the WebView by proxy. It might take a few weeks til we have something that works on all platforms, but early results on Mac and Linux are promising.

nothingismagick avatar Jan 03 '20 12:01 nothingismagick