[webkit-dev] how to append a signal of creat a new webview
赵经纬
2008zhjw at gmail.com
Tue Jun 10 06:01:40 PDT 2008
HI all:
I come to some problems when i use the webkit. when the browser need to
create a new window to open the new
link,the webkit can't provide a right singal.As you know many browsers for
mobile devices use WebKit at the core of
the application, such as OpenMoko-Browser.
First i compile the main.c in the path
/WebKit/WebKitTools/GtkLauncher.and run it on my X86 computer.In the entry
of the browser,I input www.google.com . the browser open the website
correctly.then i input the key word "baidu" in
the search filed. the google will list many websites related "baidu". but
when i click one of them, the browser do
nothing and can't open the site. how can i display the website responding to
the click?
The same things happened on the openmoko-browser2. but when i use the
gpe-mini-browser,it can work very well.
As you konw the gpe-mini-browser use osb-nrcit and osb-nrcore at the core
of the application.then i compare them
and find that there is a defined signal "req_new_window" in osb-nrcit. the
signal "req_new_window" can notify the
application that whether the browser create a new page to open the url.
Below is the key code :
g_signal_connect (G_OBJECT(html), "req_new_window",
G_CALLBACK(new_window), html);
GtkWidget * new_window(Webi * view, char const * url, gpointer data)
{
if (fork())
return NULL;
else
{
printf("url = %s\n", url);
execlp("gpe-mini-browser", "gpe-mini-browser", url);
}
return NULL;
}
in the webkit i find the signal "hovering-over-link",and i modify the
/WebKit/WebKitTools/GtkLauncher/main.c as
follow:
static GtkWidget* link_hover_cb (WebKitWebView* page, const gchar* title,
const gchar* link, gpointer data)
{
/* underflow is allowed */
gtk_statusbar_pop (main_statusbar, status_context_id);
if (link)
{
gtk_statusbar_push (main_statusbar, status_context_id, link);
if (fork())
return NULL;
else
{
printf("url = %s\n", link);
execlp("/home/root/openmoko-browser2",
"/home/root/openmoko-browser2", link);
}
}
return NULL;
}
then i compile it and run, we can solove the above problem, But when the
brower visit some websites, the browser
create two same pages when i click the link.
Next, how can i display the website responding to the click in the webkit
correctly?
thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20080610/0b6d7588/attachment.htm
More information about the webkit-dev
mailing list