Hello everybody,

I need a web browser that has no extras but shows a website. Additionally it
may not accept any key stokes. So I added kiosk mode to surf which can be
enable with parameter '-k'. This simply disables callback for key input.
Patch is applied, would be great if you apply this.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
diff --git a/config.def.h b/config.def.h
index d9a2be9..adfa7a6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -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;
 
 /* Webkit default features */
 static Bool enablescrollbars = TRUE;
diff --git a/surf.1 b/surf.1
index 97c00f0..6b8e233 100644
--- a/surf.1
+++ b/surf.1
@@ -32,6 +32,9 @@ Reparents to window specified by
 .B \-i
 Disable Images
 .TP
+.B \-k
+Enable kiosk mode (disable key stokes)
+.TP
 .B \-n
 Disable the Web Inspector (Developer Tools).
 .TP
diff --git a/surf.c b/surf.c
index 214b9c7..06d6767 100644
--- a/surf.c
+++ b/surf.c
@@ -644,7 +644,8 @@ newclient(void) {
 	g_signal_connect(G_OBJECT(c->win),
 			"destroy",
 			G_CALLBACK(destroywin), c);
-	g_signal_connect(G_OBJECT(c->win),
+	if (!kioskmode)
+		g_signal_connect(G_OBJECT(c->win),
 			"key-press-event",
 			G_CALLBACK(keypress), c);
 
@@ -790,7 +791,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];
 
@@ -804,6 +805,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)
@@ -1180,7 +1183,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));
 }
 
@@ -1226,6 +1229,9 @@ main(int argc, char *argv[]) {
 	case 'i':
 		loadimages = 0;
 		break;
+	case 'k':
+		kioskmode = 1;
+		break;
 	case 'n':
 		enableinspector = 0;
 		break;

Attachment: signature.asc
Description: PGP signature



Reply via email to