GTK: Use new BW_CREATE_FOREGROUND flags
This gets rid of temp_open_background which was, frankly, a bit of an eyesore. In addition it makes the open-in-new-tab context menu action behave like Firefox's with respect to the user's preference regarding whether or not to immediately focus new tabs. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
f3bdee255d
commit
5c377cd285
|
@ -547,8 +547,6 @@ nsgtk_on_link_opentab_activate_menu(GtkMenuItem *widget, gpointer data)
|
||||||
if (current_menu_features.link == NULL)
|
if (current_menu_features.link == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
temp_open_background = 1;
|
|
||||||
|
|
||||||
err = browser_window_create(BW_CREATE_CLONE |
|
err = browser_window_create(BW_CREATE_CLONE |
|
||||||
BW_CREATE_HISTORY |
|
BW_CREATE_HISTORY |
|
||||||
BW_CREATE_TAB,
|
BW_CREATE_TAB,
|
||||||
|
@ -557,8 +555,6 @@ nsgtk_on_link_opentab_activate_menu(GtkMenuItem *widget, gpointer data)
|
||||||
nsgtk_warning(messages_get_errorcode(err), 0);
|
nsgtk_warning(messages_get_errorcode(err), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_open_background = -1;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -926,7 +926,7 @@ nsgtk_browser_window_create(struct browser_window *bw, bool intab)
|
||||||
{
|
{
|
||||||
nserror res = NSERROR_OK;
|
nserror res = NSERROR_OK;
|
||||||
nsurl *url = NULL;
|
nsurl *url = NULL;
|
||||||
int flags = BW_CREATE_HISTORY;
|
int flags = BW_CREATE_HISTORY | BW_CREATE_FOREGROUND;
|
||||||
|
|
||||||
if (intab) {
|
if (intab) {
|
||||||
flags |= BW_CREATE_TAB;
|
flags |= BW_CREATE_TAB;
|
||||||
|
@ -1995,16 +1995,14 @@ static gboolean websearch_entry_activate_cb(GtkWidget *widget, gpointer data)
|
||||||
SEARCH_WEB_OMNI_SEARCHONLY,
|
SEARCH_WEB_OMNI_SEARCHONLY,
|
||||||
&url);
|
&url);
|
||||||
if (res == NSERROR_OK) {
|
if (res == NSERROR_OK) {
|
||||||
temp_open_background = 0;
|
|
||||||
bw = tb->get_bw(tb->get_ctx);
|
bw = tb->get_bw(tb->get_ctx);
|
||||||
|
|
||||||
res = browser_window_create(
|
res = browser_window_create(
|
||||||
BW_CREATE_HISTORY | BW_CREATE_TAB,
|
BW_CREATE_HISTORY | BW_CREATE_TAB | BW_CREATE_FOREGROUND,
|
||||||
url,
|
url,
|
||||||
NULL,
|
NULL,
|
||||||
bw,
|
bw,
|
||||||
NULL);
|
NULL);
|
||||||
temp_open_background = -1;
|
|
||||||
nsurl_unref(url);
|
nsurl_unref(url);
|
||||||
}
|
}
|
||||||
if (res != NSERROR_OK) {
|
if (res != NSERROR_OK) {
|
||||||
|
|
|
@ -143,9 +143,6 @@ struct gui_window {
|
||||||
/**< first entry in window list */
|
/**< first entry in window list */
|
||||||
struct gui_window *window_list = NULL;
|
struct gui_window *window_list = NULL;
|
||||||
|
|
||||||
/** flag controlling opening of tabs in the background */
|
|
||||||
int temp_open_background = -1;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
|
nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
|
@ -806,9 +803,13 @@ gui_window_create(struct browser_window *bw,
|
||||||
gui_window_create_flags flags)
|
gui_window_create_flags flags)
|
||||||
{
|
{
|
||||||
struct gui_window *g; /* what is being created to return */
|
struct gui_window *g; /* what is being created to return */
|
||||||
bool tempback;
|
bool open_in_background = !(nsoption_bool(focus_new));
|
||||||
GtkBuilder* tab_builder;
|
GtkBuilder* tab_builder;
|
||||||
|
|
||||||
|
/* If there is a foreground request, override user preference */
|
||||||
|
if (flags & GW_CREATE_FOREGROUND)
|
||||||
|
open_in_background = false;
|
||||||
|
|
||||||
nserror res;
|
nserror res;
|
||||||
|
|
||||||
res = nsgtk_builder_new_from_resname("tabcontents", &tab_builder);
|
res = nsgtk_builder_new_from_resname("tabcontents", &tab_builder);
|
||||||
|
@ -953,18 +954,9 @@ gui_window_create(struct browser_window *bw,
|
||||||
nsgtk_window_input_method_commit, g);
|
nsgtk_window_input_method_commit, g);
|
||||||
|
|
||||||
/* add the tab container to the scaffold notebook */
|
/* add the tab container to the scaffold notebook */
|
||||||
switch (temp_open_background) {
|
nsgtk_tab_add(g, g->container,
|
||||||
case -1:
|
open_in_background,
|
||||||
tempback = !(nsoption_bool(focus_new));
|
messages_get("NewTab"), g->icon);
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
tempback = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tempback = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
nsgtk_tab_add(g, g->container, tempback, messages_get("NewTab"), g->icon);
|
|
||||||
|
|
||||||
/* initialy should not be visible */
|
/* initialy should not be visible */
|
||||||
nsgtk_search_toggle_visibility(g->search);
|
nsgtk_search_toggle_visibility(g->search);
|
||||||
|
|
|
@ -23,7 +23,6 @@ extern struct gui_window_table *nsgtk_window_table;
|
||||||
extern struct gui_search_web_table *nsgtk_search_web_table;
|
extern struct gui_search_web_table *nsgtk_search_web_table;
|
||||||
|
|
||||||
extern struct gui_window *window_list;
|
extern struct gui_window *window_list;
|
||||||
extern int temp_open_background;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get core browsing context from gui window handle
|
* get core browsing context from gui window handle
|
||||||
|
|
Loading…
Reference in New Issue