summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-02-22 15:12:22 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-02-22 15:12:22 +0000
commit5239163f4dd47a3f9ca74501575053a69c5a95b8 (patch)
tree1ea16f53556e408dc016c73d32a4f1a1eb7104cf
parent0fa5f81a52a62a04f4564d84e391543995cf9418 (diff)
downloadnetsurf-5239163f4dd47a3f9ca74501575053a69c5a95b8.tar.gz
netsurf-5239163f4dd47a3f9ca74501575053a69c5a95b8.tar.bz2
GTK: Request and honour location focus
So that when we create a new tab we automatically focus the location box, pass the flag into create, and honour it when it comes back to us. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r--frontends/gtk/toolbar.c2
-rw-r--r--frontends/gtk/window.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 1a6bc124e..c9ec19caf 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -926,7 +926,7 @@ nsgtk_browser_window_create(struct browser_window *bw, bool intab)
{
nserror res = NSERROR_OK;
nsurl *url = NULL;
- int flags = BW_CREATE_HISTORY | BW_CREATE_FOREGROUND;
+ int flags = BW_CREATE_HISTORY | BW_CREATE_FOREGROUND | BW_CREATE_FOCUS_LOCATION;
if (intab) {
flags |= BW_CREATE_TAB;
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index b47a1b07d..64f09ebbf 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -969,6 +969,13 @@ gui_window_create(struct browser_window *bw,
*/
g_object_unref(tab_builder);
+ /* Finally we need to focus the location bar if requested */
+ if (flags & GW_CREATE_FOCUS_LOCATION) {
+ if (nsgtk_window_item_activate(g, OPENLOCATION_BUTTON) != NSERROR_OK) {
+ NSLOG(netsurf, WARNING, "Unable to focus location input");
+ }
+ }
+
return g;
}