Add an ACTIVE switch to the OPEN ARexx command to force new tabs to be active

This commit is contained in:
Chris Young 2016-09-10 20:36:11 +01:00
parent 7cbff32f92
commit 1f96c0a413
3 changed files with 24 additions and 10 deletions

View File

@ -90,7 +90,7 @@ STATIC VOID rx_hotlist(struct ARexxCmd *, struct RexxMsg *);
STATIC struct ARexxCmd Commands[] = 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 }, {"QUIT",RX_QUIT,rx_quit,NULL, 0, NULL, 0, 0, NULL },
{"TOFRONT",RX_TOFRONT,rx_tofront,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 }, {"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, NULL,
gw->bw, gw->bw,
NULL); NULL);
if(cmd->ac_ArgList[6]) {
ami_gui_switch_to_new_tab(gw->shared);
}
} }
} }
else if(cmd->ac_ArgList[1]) else if(cmd->ac_ArgList[1])

View File

@ -3476,6 +3476,19 @@ void ami_gui_set_scale(struct gui_window *gw, float scale)
browser_window_set_scale(gw->bw, scale, true); 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) nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
{ {
nsurl *url; nsurl *url;
@ -3497,15 +3510,7 @@ nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
return error; return error;
} }
if(nsoption_bool(new_tab_is_active) == false) { ami_gui_switch_to_new_tab(gwin);
/* 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; return NSERROR_OK;
} }

View File

@ -245,5 +245,10 @@ STRPTR ami_gui_get_screen_title(void);
* Set gui_globals back to the default for the browser context * Set gui_globals back to the default for the browser context
*/ */
void ami_gui_set_default_gg(void); 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 #endif