WebKitWebPolicyDecision *policy_decision,
wxWebViewWebKit *webKitCtrl)
{
+ const gchar* uri = webkit_network_request_get_uri(request);
+ wxString target = webkit_web_frame_get_name (frame);
+
+ //If m_creating is true then we are the result of a new window
+ //and so we need to send the event and veto the load
+ if(webKitCtrl->m_creating)
+ {
+ webKitCtrl->m_creating = false;
+ wxWebViewEvent event(wxEVT_WEBVIEW_NEWWINDOW,
+ webKitCtrl->GetId(),
+ wxString(uri, wxConvUTF8),
+ target);
+
+ if(webKitCtrl && webKitCtrl->GetEventHandler())
+ webKitCtrl->GetEventHandler()->ProcessEvent(event);
+
+ webkit_web_policy_decision_ignore(policy_decision);
+ return TRUE;
+ }
+
if(webKitCtrl->m_guard)
{
webKitCtrl->m_guard = false;
webKitCtrl->m_busy = true;
- const gchar* uri = webkit_network_request_get_uri(request);
-
- wxString target = webkit_web_frame_get_name (frame);
wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATING,
webKitCtrl->GetId(),
wxString( uri, wxConvUTF8 ),
#endif
+static WebKitWebView*
+wxgtk_webview_webkit_create_webview(WebKitWebView *web_view,
+ WebKitWebFrame *frame,
+ wxWebViewWebKit *webKitCtrl)
+{
+ //As we do not know the uri being loaded at this point allow the load to
+ //continue and catch it in navigation-policy-decision-requested
+ webKitCtrl->m_creating = true;
+ return web_view;
+}
+
} // extern "C"
//-----------------------------------------------------------------------------
{
m_busy = false;
m_guard = false;
+ m_creating = false;
FindClear();
// We currently unconditionally impose scrolling in both directions as it's
g_signal_connect_after(m_web_view, "context-menu",
G_CALLBACK(wxgtk_webview_webkit_context_menu), this);
#endif
+
+ g_signal_connect_after(m_web_view, "create-web-view",
+ G_CALLBACK(wxgtk_webview_webkit_create_webview), this);
m_parent->DoAddChild( this );