It would be different, as winforms doesn't have a gtk main loop which the webkit widget can use. There is an experimental webkit backend for the webbrowser control on winforms which takes care of this little problem, it's on http://anonsvn.mono-project.com/source/trunk/mono-webbrowser
You can see how it's doing it by looking at mono-webkit/EmbedWidget.cs and mono-webkit/WebBrowser.cs (the Load and InitializeWindow are the methods that make it go).
The EmbedWidget class basically wraps a winforms control inside a gtk window, and WebBrowser runs the gtk main loop on a separate thread and creates the EmbedWidget, adding a WebView to it. This allows both winforms and gtk loops to run side by side without interfering with each other.
Andreia Gaita works at GitHub and is a Mono / Unity / C# / C / C++ developer from Portugal, currently residing in happy Copenhagen, Denmark. She currently likes (not ordered by any particular criteria) cats!!, traveling, refcounting, git, pasta, and porting tools and libraries to Linux and OSX on the Mono, .Net and gamedev ecosystems.
2 comments:
Nice! Would it be much harder if using System.Windows.Forms?
It would be different, as winforms doesn't have a gtk main loop which the webkit widget can use. There is an experimental webkit backend for the webbrowser control on winforms which takes care of this little problem, it's on http://anonsvn.mono-project.com/source/trunk/mono-webbrowser
You can see how it's doing it by looking at mono-webkit/EmbedWidget.cs and mono-webkit/WebBrowser.cs (the Load and InitializeWindow are the methods that make it go).
The EmbedWidget class basically wraps a winforms control inside a gtk window, and WebBrowser runs the gtk main loop on a separate thread and creates the EmbedWidget, adding a WebView to it. This allows both winforms and gtk loops to run side by side without interfering with each other.
Post a Comment