pinosaur
/
surf.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
244dfd3
)
Importing the generic toggle patch of stanio@cs.tu-berlin.de. Thanks!
author
Christoph Lohmann
<20h@r-36.net>
Thu, 15 Nov 2012 13:52:22 +0000
(14:52 +0100)
committer
Christoph Lohmann
<20h@r-36.net>
Thu, 15 Nov 2012 13:52:22 +0000
(14:52 +0100)
config.def.h
patch
|
blob
|
history
surf.c
patch
|
blob
|
history
diff --git
a/config.def.h
b/config.def.h
index
3fb13b0
..
5f554ff
100644
(file)
--- a/
config.def.h
+++ b/
config.def.h
@@
-52,5
+52,9
@@
static Key keys[] = {
{ 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_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 --git
a/surf.c
b/surf.c
index
390eaf0
..
7fa0eb6
100644
(file)
--- a/
surf.c
+++ b/
surf.c
@@
-126,6
+126,7
@@
static void spawn(Client *c, const Arg *arg);
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 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);
static void update(Client *c);
static void updatewinid(Client *c);
static void usage(void);
@@
-889,6
+890,20
@@
titlechange(WebKitWebView *v, WebKitWebFrame *f, const char *t, Client *c) {
update(c);
}
update(c);
}
+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;
void
update(Client *c) {
char *t;