Reputation: 9
so recently I've been playing around with Vala and Gtk+3.0 and I decided to create a really simple web browser as a part of one of my apps, in order to show one of my webpages which uses Google Maps API to show some markers. I've created a class that looks like this:
using Gtk;
using WebKit;
public class WebBrowser : Window {
private string URL = "";
private WebView view;
// Constructor
public WebBrowser () {
this.view = new WebView();
var settings = this.view.get_settings();
settings.enable_plugins = true;
settings.enable_javascript = true;
this.add(view);
}
public void visit (string url) {
this.URL = url;
this.view.load_uri(this.URL);
}
}
In the compile flags i used
--pkg gtk+-3.0 --pkg webkit2gtk-4.0
The class is used like this (will use random data here):
var browser = new WebBrowser();
browser.set_title ("Custom window title!");
browser.default_width = 1200;
browser.default_height = 800;
browser.visit ("http://acid3.acidtests.org/");
browser.show_all ();
and it works. It scores 100/100 on the test. The only problem is, I cannot use the actual WebKit object. When I resize the window, WebKit behaves normally and it resizes the webpage correctly, but I cannot close the window, nor interact with the webpage in any way. I could handle some signals and close the window manually, but WebKit still appears "frozzen". Is there any way to enable mouse control over the object or is this just a bug? At first I thought this has to do with the fact that I am using gtk+-3.0 and that webkit2gtk-4.0 may be intended for some newer versions of gtk, but somewhere I read that webkit2gtk-3.0 was renamed to webkit2gtk-4.0 and indeed, my app won't compile if I use the older version of the WebKit2.
Upvotes: 0
Views: 249
Reputation: 516
Which version of WebKitGTK are you running? If 2.16, then you are likely encountering this bug: https://bugs.webkit.org/show_bug.cgi?id=170450 The fix for that will be released in 2.16.2, but Fedora already has the patch added to version 2.16.1-2 of their package.
Upvotes: 0