+ if(arg->v)
+ uri = (char *)arg->v;
+ else
+ uri = c->linkhover ? c->linkhover : geturi(c);
+ r = webkit_network_request_new(uri);
+ dl = webkit_download_new(r);
+ initdownload(c->view, dl, c);
+}
+
+void
+drawindicator(Client *c) {
+ gint width;
+ const char *uri;
+ GtkWidget *w;
+ GdkGC *gc;
+ GdkColor fg;
+
+ uri = getatom(c, uriprop);
+ w = c->indicator;
+ width = c->progress * w->allocation.width / 100;
+ gc = gdk_gc_new(w->window);
+ gdk_color_parse(strstr(uri, "https://") == uri ?
+ progress_trust : progress, &fg);
+ gdk_gc_set_rgb_fg_color(gc, &fg);
+ gdk_draw_rectangle(w->window,
+ w->style->bg_gc[GTK_WIDGET_STATE(w)],
+ TRUE, 0, 0, w->allocation.width, w->allocation.height);
+ gdk_draw_rectangle(w->window, gc, TRUE, 0, 0, width,
+ w->allocation.height);
+ g_object_unref(gc);
+}
+
+gboolean
+exposeindicator(GtkWidget *w, GdkEventExpose *e, Client *c) {
+ drawindicator(c);
+ return TRUE;
+}
+
+void
+find(Client *c, const Arg *arg) {
+ const char *s;
+
+ s = getatom(c, findprop);
+ gboolean forward = *(gboolean *)arg;
+ webkit_web_view_search_text(c->view, s, FALSE, forward, TRUE);
+}
+
+const char *
+getatom(Client *c, Atom a) {
+ static char buf[BUFSIZ];
+ Atom adummy;
+ int idummy;
+ unsigned long ldummy;
+ unsigned char *p = NULL;
+
+ XGetWindowProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window),
+ a, 0L, BUFSIZ, False, XA_STRING,
+ &adummy, &idummy, &ldummy, &ldummy, &p);
+ if(p)
+ strncpy(buf, (char *)p, LENGTH(buf)-1);
+ else
+ buf[0] = '\0';
+ XFree(p);
+ return buf;
+}
+
+char *
+geturi(Client *c) {
+ char *uri;
+
+ if(!(uri = (char *)webkit_web_view_get_uri(c->view)))
+ uri = "about:blank";
+ return uri;