Introduction
Introduction Statistics Contact Development Disclaimer Help
tAdding kiosk mode. - surf - customized build of surf, the suckless webkit brow…
git clone git://src.adamsgaard.dk/surf
Log
Files
Refs
README
LICENSE
---
commit badb84387e659ba1692c08f728ad6e7846d37818
parent fe3bd631d4e163e15ab685c22ad70c67f8b94f83
Author: Christoph Lohmann <[email protected]>
Date: Mon, 11 Mar 2013 21:26:22 +0100
Adding kiosk mode.
Thanks to Christian Hesse <[email protected]>!
Diffstat:
M config.def.h | 1 +
M surf.1 | 5 ++++-
M surf.c | 19 ++++++++++++++-----
3 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/config.def.h b/config.def.h
t@@ -8,6 +8,7 @@ static char *cookiefile = "~/.surf/cookies.txt";
static time_t sessiontime = 3600;
static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
+static Bool kioskmode = FALSE; /* Ignore shortcuts */
/* Webkit default features */
static Bool enablescrollbars = TRUE;
diff --git a/surf.1 b/surf.1
t@@ -3,7 +3,7 @@
surf \- simple webkit-based browser
.SH SYNOPSIS
.B surf
-.RB [-bipnsvx]
+.RB [-biknpsvx]
.RB [-c\ cookiefile]
.RB [-e\ xid]
.RB [-r\ scriptfile]
t@@ -32,6 +32,9 @@ Reparents to window specified by
.B \-i
Disable Images
.TP
+.B \-k
+Enable kiosk mode (disable key strokes and right click)
+.TP
.B \-n
Disable the Web Inspector (Developer Tools).
.TP
diff --git a/surf.c b/surf.c
t@@ -644,9 +644,11 @@ newclient(void) {
g_signal_connect(G_OBJECT(c->win),
"destroy",
G_CALLBACK(destroywin), c);
- g_signal_connect(G_OBJECT(c->win),
- "key-press-event",
- G_CALLBACK(keypress), c);
+ if(!kioskmode) {
+ g_signal_connect(G_OBJECT(c->win),
+ "key-press-event",
+ G_CALLBACK(keypress), c);
+ }
/* Pane */
c->pane = gtk_vpaned_new();
t@@ -748,6 +750,8 @@ newclient(void) {
enablespatialbrowsing, NULL);
g_object_set(G_OBJECT(settings), "enable-developer-extras",
enableinspector, NULL);
+ g_object_set(G_OBJECT(settings), "enable-default-context-menu",
+ kioskmode ^ 1, NULL);
if(enableinspector) {
c->inspector = WEBKIT_WEB_INSPECTOR(
t@@ -790,7 +794,7 @@ newclient(void) {
static void
newwindow(Client *c, const Arg *arg, gboolean noembed) {
guint i = 0;
- const char *cmd[11], *uri;
+ const char *cmd[12], *uri;
const Arg a = { .v = (void *)cmd };
char tmp[64];
t@@ -804,6 +808,8 @@ newwindow(Client *c, const Arg *arg, gboolean noembed) {
}
if(!loadimages)
cmd[i++] = "-i";
+ if(!kioskmode)
+ cmd[i++] = "-k";
if(!enableplugins)
cmd[i++] = "-p";
if(!enablescripts)
t@@ -1180,7 +1186,7 @@ updatewinid(Client *c) {
static void
usage(void) {
- die("usage: %s [-binpsvx] [-c cookiefile] [-e xid] [-r scriptfile]"
+ die("usage: %s [-biknpsvx] [-c cookiefile] [-e xid] [-r scriptfile]"
" [-t stylefile] [-u useragent] [uri]\n", basename(argv0));
}
t@@ -1226,6 +1232,9 @@ main(int argc, char *argv[]) {
case 'i':
loadimages = 0;
break;
+ case 'k':
+ kioskmode = 1;
+ break;
case 'n':
enableinspector = 0;
break;
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.