Use HandleWindowEvent() from C callbacks
Avoids issues with exceptions. Also remove worthless null pointer checks, the pointer has already been dereferenced, and GetEventHandler() never returns NULL
This commit is contained in:
parent
188b249467
commit
b4a6f39ab2
@ -63,8 +63,7 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget,
|
||||
webKitCtrl->GetId(),
|
||||
url, target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
}
|
||||
else if (status == WEBKIT_LOAD_COMMITTED)
|
||||
{
|
||||
@ -73,8 +72,7 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget,
|
||||
webKitCtrl->GetId(),
|
||||
url, target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,9 +97,8 @@ wxgtk_webview_webkit_navigation(WebKitWebView *,
|
||||
wxString(uri, wxConvUTF8),
|
||||
target);
|
||||
|
||||
if(webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
|
||||
webkit_web_policy_decision_ignore(policy_decision);
|
||||
return TRUE;
|
||||
}
|
||||
@ -123,8 +120,7 @@ wxgtk_webview_webkit_navigation(WebKitWebView *,
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
|
||||
if (!event.IsAllowed())
|
||||
{
|
||||
@ -297,10 +293,7 @@ wxgtk_webview_webkit_error(WebKitWebView*,
|
||||
event.SetString(description);
|
||||
event.SetInt(type);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
{
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
webKitWindow->HandleWindowEvent(event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -321,8 +314,7 @@ wxgtk_webview_webkit_new_window(WebKitWebView*,
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
|
||||
//We always want the user to handle this themselves
|
||||
webkit_web_policy_decision_ignore(policy_decision);
|
||||
@ -341,9 +333,7 @@ wxgtk_webview_webkit_title_changed(WebKitWebView*,
|
||||
"");
|
||||
event.SetString(wxString(title, wxConvUTF8));
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -44,8 +44,7 @@ wxgtk_webview_webkit_load_changed(GtkWidget *,
|
||||
webKitCtrl->GetId(),
|
||||
url, target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
}
|
||||
else if (load_event == WEBKIT_LOAD_COMMITTED)
|
||||
{
|
||||
@ -54,8 +53,7 @@ wxgtk_webview_webkit_load_changed(GtkWidget *,
|
||||
webKitCtrl->GetId(),
|
||||
url, target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,9 +78,8 @@ wxgtk_webview_webkit_navigation(WebKitWebView *web_view,
|
||||
wxString(uri, wxConvUTF8),
|
||||
target);
|
||||
|
||||
if(webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
|
||||
webkit_policy_decision_ignore(decision);
|
||||
return TRUE;
|
||||
}
|
||||
@ -104,8 +101,7 @@ wxgtk_webview_webkit_navigation(WebKitWebView *web_view,
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
|
||||
if (!event.IsAllowed())
|
||||
{
|
||||
@ -256,10 +252,7 @@ wxgtk_webview_webkit_load_failed(WebKitWebView *,
|
||||
event.SetString(description);
|
||||
event.SetInt(type);
|
||||
|
||||
if (webKitWindow && webKitWindow->GetEventHandler())
|
||||
{
|
||||
webKitWindow->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
webKitWindow->HandleWindowEvent(event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -279,8 +272,7 @@ wxgtk_webview_webkit_new_window(WebKitPolicyDecision *decision,
|
||||
wxString( uri, wxConvUTF8 ),
|
||||
target);
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
|
||||
//We always want the user to handle this themselves
|
||||
webkit_policy_decision_ignore(decision);
|
||||
@ -318,8 +310,7 @@ wxgtk_webview_webkit_title_changed(GtkWidget* widget,
|
||||
"");
|
||||
event.SetString(wxString(title, wxConvUTF8));
|
||||
|
||||
if (webKitCtrl && webKitCtrl->GetEventHandler())
|
||||
webKitCtrl->GetEventHandler()->ProcessEvent(event);
|
||||
webKitCtrl->HandleWindowEvent(event);
|
||||
|
||||
g_free(title);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user