From 7b5639d9821ca94865e25bc7c53fb3f93108c455 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 4 Sep 2016 17:35:32 +0100 Subject: When opening a new blank tab, always switch to it. --- frontends/amiga/gui.c | 19 +++++++++++++++---- frontends/amiga/gui.h | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'frontends/amiga') diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index a530d62c2..9e5850a85 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -2875,7 +2875,7 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw) struct IBox *bbox; /* Clear the last new tab list */ - gwin->gw->last_new_tab = NULL; + gwin->last_new_tab = NULL; if(gwin->tabs == 0) return; @@ -3513,6 +3513,16 @@ nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin) return error; } + if(nsoption_bool(new_tab_is_active) == false) { + /* Because this is a new blank tab, switch to it (if new_tab_is_active, we already did!) */ + RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_TABS], + gwin->win, NULL, + CLICKTAB_CurrentNode, gwin->last_new_tab, + TAG_DONE); + + ami_switch_tab(gwin, false); + } + return NSERROR_OK; } @@ -3863,12 +3873,13 @@ gui_window_create(struct browser_window *bw, } else { struct Node *insert_after = existing->tab_node; - if(existing->last_new_tab) - insert_after = existing->last_new_tab; + if(g->shared->last_new_tab) + insert_after = g->shared->last_new_tab; Insert(&g->shared->tab_list, g->tab_node, insert_after); - existing->last_new_tab = g->tab_node; } + g->shared->last_new_tab = g->tab_node; + RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS], g->shared->win, NULL, CLICKTAB_Labels, &g->shared->tab_list, diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index c1513a075..52411c427 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -101,6 +101,7 @@ struct gui_window_2 { struct List tab_list; ULONG tabs; ULONG next_tab; + struct Node *last_new_tab; struct Hook scrollerhook; struct form_control *control; browser_mouse_state mouse_state; @@ -152,7 +153,6 @@ struct gui_window struct gui_window_2 *shared; int tab; struct Node *tab_node; - struct Node *last_new_tab; int c_x; /* Caret X posn */ int c_y; /* Caret Y posn */ int c_w; /* Caret width */ -- cgit v1.2.3