[hackers] [surf] Importing the generic toggle patch of stanio_AT_cs.tu-berlin.de. Thanks! || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Thu, 15 Nov 2012 15:28:51 +0100 (CET)

changeset: 262:f38404983e69
user: Christoph Lohmann <20h_AT_r-36.net>
date: Thu Nov 15 14:52:22 2012 +0100
files: config.def.h surf.c
description:
Importing the generic toggle patch of stanio_AT_cs.tu-berlin.de. Thanks!


diff -r 51ad1615f445 -r f38404983e69 config.def.h
--- a/config.def.h Thu Nov 08 22:05:40 2012 +0100
+++ b/config.def.h Thu Nov 15 14:52:22 2012 +0100
_AT_@ -52,5 +52,9 @@
     { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
     { MODKEY, GDK_n, find, { .b = TRUE } },
     { MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
+ { MODKEY, GDK_v, toggle, { .v = "enable-plugins" } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
+ { MODKEY, GDK_c, toggle, { .v = "enable-caret-browsing" } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
 };
 
diff -r 51ad1615f445 -r f38404983e69 surf.c
--- a/surf.c Thu Nov 08 22:05:40 2012 +0100
+++ b/surf.c Thu Nov 15 14:52:22 2012 +0100
_AT_@ -126,6 +126,7 @@
 static void eval(Client *c, const Arg *arg);
 static void stop(Client *c, const Arg *arg);
 static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* title, Client *c);
+static void toggle(Client *c, const Arg *arg);
 static void update(Client *c);
 static void updatewinid(Client *c);
 static void usage(void);
_AT_@ -890,6 +891,20 @@
 }
 
 void
+toggle(Client *c, const Arg *arg) {
+ WebKitWebSettings *settings;
+ char *name = (char *)arg->v;
+ gboolean value;
+ Arg a = { .b = FALSE };
+
+ settings = webkit_web_view_get_settings(c->view);
+ g_object_get(G_OBJECT(settings), name, &value, NULL);
+ g_object_set(G_OBJECT(settings), name, !value, NULL);
+
+ reload(c,&a);
+}
+
+void
 update(Client *c) {
         char *t;
 
Received on Thu Nov 15 2012 - 15:28:51 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 15 2012 - 15:36:11 CET