+void
+print(Client *c, const Arg *arg) {
+ webkit_web_frame_print(webkit_web_view_get_main_frame(c->view));
+}
+
+void
+progresschange(WebKitWebView *v, gint p, Client *c) {
+ c->progress = p;
+ update(c);
+}
+
+void
+reload(Client *c, const Arg *arg) {
+ gboolean nocache = *(gboolean *)arg;
+ if(nocache)
+ webkit_web_view_reload_bypass_cache(c->view);
+ else
+ webkit_web_view_reload(c->view);
+}
+
+void
+reloadcookies() {
+ SoupCookieJar *jar;
+ GSList *l, *e;
+
+ lockcookie = TRUE;
+ for(l = e = soup_cookie_jar_all_cookies(cookies); e; e = e->next)
+ soup_cookie_jar_delete_cookie(cookies, (SoupCookie *)e->data);
+ soup_cookies_free(l);
+ jar = soup_cookie_jar_text_new(cookiefile, TRUE);
+ for(l = e = soup_cookie_jar_all_cookies(jar); e; e = e->next)
+ soup_cookie_jar_add_cookie(cookies, (SoupCookie *)e->data);
+ g_slist_free(l);
+ lockcookie = FALSE;
+ g_object_unref(jar);
+}
+
+void
+scroll(Client *c, const Arg *arg) {
+ gdouble v;
+ GtkAdjustment *a;
+
+ a = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(c->scroll));
+ v = gtk_adjustment_get_value(a);
+ v += gtk_adjustment_get_step_increment(a) * arg->i;
+ v = MAX(v, 0.0);
+ v = MIN(v, gtk_adjustment_get_upper(a) - gtk_adjustment_get_page_size(a));
+ gtk_adjustment_set_value(a, v);
+}
+
+void
+resize(GtkWidget *w, GtkAllocation *a, Client *c) {
+ double zoom;
+
+ if(c->zoomed)
+ return;
+ zoom = webkit_web_view_get_zoom_level(c->view);
+ if(a->width * a->height < 300 * 400 && zoom != 0.2)
+ webkit_web_view_set_zoom_level(c->view, 0.2);
+ else if(zoom != 1.0)
+ webkit_web_view_set_zoom_level(c->view, 1.0);
+}
+
+void
+sigchld(int unused) {
+ if(signal(SIGCHLD, sigchld) == SIG_ERR)
+ die("Can't install SIGCHLD handler");
+ while(0 < waitpid(-1, NULL, WNOHANG));
+}
+
+void
+setatom(Client *c, Atom a, const char *v) {
+ XSync(dpy, False);
+ ignorexprop++;
+ XChangeProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window), a,
+ XA_STRING, 8, PropModeReplace, (unsigned char *)v,
+ strlen(v) + 1);
+}
+
+void
+setup(void) {
+ SoupSession *s;
+
+ /* clean up any zombies immediately */
+ sigchld(0);
+ gtk_init(NULL, NULL);
+ if (!g_thread_supported())
+ g_thread_init(NULL);
+