From 1f96c0a413c26db03cd2921ef795972c47997747 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 10 Sep 2016 20:36:11 +0100 Subject: Add an ACTIVE switch to the OPEN ARexx command to force new tabs to be active --- frontends/amiga/arexx.c | 6 +++++- frontends/amiga/gui.c | 23 ++++++++++++++--------- frontends/amiga/gui.h | 5 +++++ 3 files changed, 24 insertions(+), 10 deletions(-) (limited to 'frontends/amiga') diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c index ad67368a5..13a5d222f 100644 --- a/frontends/amiga/arexx.c +++ b/frontends/amiga/arexx.c @@ -90,7 +90,7 @@ STATIC VOID rx_hotlist(struct ARexxCmd *, struct RexxMsg *); STATIC struct ARexxCmd Commands[] = { - {"OPEN",RX_OPEN,rx_open,"URL/A,NEW=NEWWINDOW/S,NEWTAB/S,SAVEAS/K,W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL }, + {"OPEN",RX_OPEN,rx_open,"URL/A,NEW=NEWWINDOW/S,NEWTAB/S,SAVEAS/K,W=WINDOW/K/N,T=TAB/K/N,ACTIVE/S", 0, NULL, 0, 0, NULL }, {"QUIT",RX_QUIT,rx_quit,NULL, 0, NULL, 0, 0, NULL }, {"TOFRONT",RX_TOFRONT,rx_tofront,NULL, 0, NULL, 0, 0, NULL }, {"GETURL",RX_GETURL,rx_geturl, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL }, @@ -293,6 +293,10 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu NULL, gw->bw, NULL); + + if(cmd->ac_ArgList[6]) { + ami_gui_switch_to_new_tab(gw->shared); + } } } else if(cmd->ac_ArgList[1]) diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 9aaf182ee..0a324ca68 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -3476,6 +3476,19 @@ void ami_gui_set_scale(struct gui_window *gw, float scale) browser_window_set_scale(gw->bw, scale, true); } +void ami_gui_switch_to_new_tab(struct gui_window_2 *gwin) +{ + if(nsoption_bool(new_tab_is_active) == true) return; + + /* Switch to the just-opened tab (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); +} + nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin) { nsurl *url; @@ -3497,15 +3510,7 @@ 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); - } + ami_gui_switch_to_new_tab(gwin); return NSERROR_OK; } diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index 52411c427..6d5188e44 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -245,5 +245,10 @@ STRPTR ami_gui_get_screen_title(void); * Set gui_globals back to the default for the browser context */ void ami_gui_set_default_gg(void); + +/** + * Switch to the most-recently-opened tab + */ +void ami_gui_switch_to_new_tab(struct gui_window_2 *gwin); #endif -- cgit v1.2.3