+ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), c->linkhover ? c->linkhover : geturi(c), -1);
+}
+
+void
+context(WebKitWebView *v, GtkMenu *m, Client *c) {
+ int i;
+ GtkContainer *parent;
+
+ gtk_widget_hide_all(GTK_WIDGET(m));
+ gtk_widget_show(GTK_WIDGET(m));
+ for(i = 0; i < LENGTH(items); i++) {
+ parent = GTK_CONTAINER(gtk_widget_get_parent(c->items[i]));
+ if(parent)
+ gtk_container_remove(parent, c->items[i]);
+ gtk_menu_shell_append(GTK_MENU_SHELL(m), c->items[i]);
+ gtk_widget_show(c->items[i]);
+ }
+}
+
+char *
+copystr(char **str, const char *src) {
+ char *tmp;
+ tmp = g_strdup(src);
+
+ if(str && *str) {
+ g_free(*str);
+ *str = tmp;
+ }
+ return tmp;
+}
+
+WebKitWebView *
+createwindow(WebKitWebView *v, WebKitWebFrame *f, Client *c) {
+ Client *n = newclient();
+ return n->view;
+}
+
+gboolean
+decidedownload(WebKitWebView *v, WebKitWebFrame *f, WebKitNetworkRequest *r, gchar *m, WebKitWebPolicyDecision *p, Client *c) {
+ if(!webkit_web_view_can_show_mime_type(v, m)) {
+ webkit_web_policy_decision_download(p);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+gboolean
+decidewindow(WebKitWebView *view, WebKitWebFrame *f, WebKitNetworkRequest *r, WebKitWebNavigationAction *n, WebKitWebPolicyDecision *p, Client *c) {
+ Arg arg;
+
+ if(webkit_web_navigation_action_get_reason(n) == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
+ webkit_web_policy_decision_ignore(p);
+ arg.v = (void *)webkit_network_request_get_uri(r);
+ newwindow(NULL, &arg);
+ return TRUE;
+ }
+ return FALSE;