about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-10-27 15:19:55 -0500
committerMarco Peereboom <marco@conformal.com>2011-10-27 15:19:55 -0500
commit4b65c5f128cc168a85738031fb1d50d09cf50c33 (patch)
treec390e7476028ddd37893e510f9a5886ca8073996
parent54bbb5517118e2579605e2fae94994d476668c97 (diff)
downloadxombrero-4b65c5f128cc168a85738031fb1d50d09cf50c33.tar.gz
add autofocus_onload option
When set the browser will attempt to enable the default input on a
website.  Off by default
-rw-r--r--xxxterm.14
-rw-r--r--xxxterm.c9
-rw-r--r--xxxterm.conf1
3 files changed, 12 insertions, 2 deletions
diff --git a/xxxterm.1 b/xxxterm.1
index d5325b0..4225559 100644
--- a/xxxterm.1
+++ b/xxxterm.1
@@ -857,6 +857,10 @@ Unfortunately enabling this does allow for some limited tracking on the web.
 .It Cm append_next
 When set a new tab is appended after the current tab instead of being appended
 as the last tab.
+.It Cm autofocus_onload
+When set a tab that is loaded will attempt to autofocus the default input
+entry.
+This is only done for tabs that are currently visible.
 .It Cm browser_mode
 The
 .Nm
diff --git a/xxxterm.c b/xxxterm.c
index 57e4a80..a8825b7 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -615,6 +615,7 @@ int		history_autosave = 0;
 char		search_file[PATH_MAX];
 char		command_file[PATH_MAX];
 char		*encoding = NULL;
+int		autofocus_onload = 0;
 
 char		*cmd_font_name = NULL;
 char		*oops_font_name = NULL;
@@ -773,8 +774,9 @@ struct settings {
 	gfloat		*fval;
 	int		(*activate)(char *);
 } rs[] = {
-	{ "append_next",		XT_S_INT, 0,		&append_next, NULL, NULL },
 	{ "allow_volatile_cookies",	XT_S_INT, 0,		&allow_volatile_cookies, NULL, NULL },
+	{ "append_next",		XT_S_INT, 0,		&append_next, NULL, NULL },
+	{ "autofocus_onload",		XT_S_INT, 0,		&autofocus_onload, NULL, NULL },
 	{ "browser_mode",		XT_S_INT, 0, NULL, NULL,&s_browser_mode },
 	{ "cookie_policy",		XT_S_INT, 0, NULL, NULL,&s_cookie },
 	{ "cookies_enabled",		XT_S_INT, 0,		&cookies_enabled, NULL, NULL },
@@ -7230,8 +7232,11 @@ void
 webview_load_finished_cb(WebKitWebView *wv, WebKitWebFrame *wf, struct tab *t)
 {
 	run_script(t, JS_HINTING);
-	if (t->tab_id == gtk_notebook_get_current_page(notebook))
+	if (autofocus_onload &&
+	    t->tab_id == gtk_notebook_get_current_page(notebook))
 		run_script(t, "hints.focusInput();");
+	else
+		run_script(t, "hints.clearFocus();");
 }
 
 void
diff --git a/xxxterm.conf b/xxxterm.conf
index 95d2517..fc3a3ef 100644
--- a/xxxterm.conf
+++ b/xxxterm.conf
@@ -33,6 +33,7 @@
 # spell_check_languages	= en_US
 # xterm_workaround	= 1
 # history_autosave	= 1
+# autofocus_onload	= 1
 # encoding		= ISO-8859-1
 
 #