mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Check session- and domain-specific settings for many options
Pass the session with some get_opt_* calls. These are the low-hanging fruit. Some places will be difficult because we don't have the session or for other reasons.
This commit is contained in:
parent
360b4ebfee
commit
91947860f2
@ -27,68 +27,68 @@ init_document_options(struct session *ses, struct document_options *doo)
|
||||
/* Ensure that any padding bytes are cleared. */
|
||||
memset(doo, 0, sizeof(*doo));
|
||||
|
||||
doo->assume_cp = get_opt_codepage("document.codepage.assume", NULL);
|
||||
doo->hard_assume = get_opt_bool("document.codepage.force_assumed", NULL);
|
||||
doo->assume_cp = get_opt_codepage("document.codepage.assume", ses);
|
||||
doo->hard_assume = get_opt_bool("document.codepage.force_assumed", ses);
|
||||
|
||||
doo->use_document_colors = get_opt_int("document.colors.use_document_colors", ses);
|
||||
doo->margin = get_opt_int("document.browse.margin_width", NULL);
|
||||
doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link", NULL);
|
||||
doo->meta_link_display = get_opt_int("document.html.link_display", NULL);
|
||||
doo->default_form_input_size = get_opt_int("document.browse.forms.input_size", NULL);
|
||||
doo->margin = get_opt_int("document.browse.margin_width", ses);
|
||||
doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link", ses);
|
||||
doo->meta_link_display = get_opt_int("document.html.link_display", ses);
|
||||
doo->default_form_input_size = get_opt_int("document.browse.forms.input_size", ses);
|
||||
|
||||
/* Color options. */
|
||||
doo->default_fg = get_opt_color("document.colors.text", NULL);
|
||||
doo->default_bg = get_opt_color("document.colors.background", NULL);
|
||||
doo->default_link = get_opt_color("document.colors.link", NULL);
|
||||
doo->default_vlink = get_opt_color("document.colors.vlink", NULL);
|
||||
doo->default_fg = get_opt_color("document.colors.text", ses);
|
||||
doo->default_bg = get_opt_color("document.colors.background", ses);
|
||||
doo->default_link = get_opt_color("document.colors.link", ses);
|
||||
doo->default_vlink = get_opt_color("document.colors.vlink", ses);
|
||||
#ifdef CONFIG_BOOKMARKS
|
||||
doo->default_bookmark_link = get_opt_color("document.colors.bookmark", NULL);
|
||||
doo->default_bookmark_link = get_opt_color("document.colors.bookmark", ses);
|
||||
#endif
|
||||
doo->default_image_link = get_opt_color("document.colors.image", NULL);
|
||||
doo->default_image_link = get_opt_color("document.colors.image", ses);
|
||||
|
||||
doo->active_link.fg = get_opt_color("document.browse.links.active_link.colors.text", NULL);
|
||||
doo->active_link.bg = get_opt_color("document.browse.links.active_link.colors.background", NULL);
|
||||
doo->active_link.fg = get_opt_color("document.browse.links.active_link.colors.text", ses);
|
||||
doo->active_link.bg = get_opt_color("document.browse.links.active_link.colors.background", ses);
|
||||
|
||||
if (get_opt_bool("document.colors.increase_contrast", NULL))
|
||||
if (get_opt_bool("document.colors.increase_contrast", ses))
|
||||
doo->color_flags |= COLOR_INCREASE_CONTRAST;
|
||||
|
||||
if (get_opt_bool("document.colors.ensure_contrast", NULL))
|
||||
if (get_opt_bool("document.colors.ensure_contrast", ses))
|
||||
doo->color_flags |= COLOR_ENSURE_CONTRAST;
|
||||
|
||||
/* Boolean options. */
|
||||
#ifdef CONFIG_CSS
|
||||
doo->css_enable = get_opt_bool("document.css.enable", ses);
|
||||
doo->css_import = get_opt_bool("document.css.import", NULL);
|
||||
doo->css_import = get_opt_bool("document.css.import", ses);
|
||||
#endif
|
||||
|
||||
doo->plain_display_links = get_opt_bool("document.plain.display_links", NULL);
|
||||
doo->plain_display_links = get_opt_bool("document.plain.display_links", ses);
|
||||
doo->plain_compress_empty_lines = get_opt_bool("document.plain.compress_empty_lines", ses);
|
||||
doo->underline_links = get_opt_bool("document.html.underline_links", NULL);
|
||||
doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp", NULL);
|
||||
doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex", NULL);
|
||||
doo->underline_links = get_opt_bool("document.html.underline_links", ses);
|
||||
doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp", ses);
|
||||
doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex", ses);
|
||||
doo->links_numbering = get_opt_bool("document.browse.links.numbering", ses);
|
||||
|
||||
doo->active_link.color = get_opt_bool("document.browse.links.active_link.enable_color", NULL);
|
||||
doo->active_link.invert = get_opt_bool("document.browse.links.active_link.invert", NULL);
|
||||
doo->active_link.underline = get_opt_bool("document.browse.links.active_link.underline", NULL);
|
||||
doo->active_link.bold = get_opt_bool("document.browse.links.active_link.bold", NULL);
|
||||
doo->active_link.color = get_opt_bool("document.browse.links.active_link.enable_color", ses);
|
||||
doo->active_link.invert = get_opt_bool("document.browse.links.active_link.invert", ses);
|
||||
doo->active_link.underline = get_opt_bool("document.browse.links.active_link.underline", ses);
|
||||
doo->active_link.bold = get_opt_bool("document.browse.links.active_link.bold", ses);
|
||||
|
||||
doo->table_order = get_opt_bool("document.browse.table_move_order", NULL);
|
||||
doo->table_order = get_opt_bool("document.browse.table_move_order", ses);
|
||||
doo->tables = get_opt_bool("document.html.display_tables", ses);
|
||||
doo->frames = get_opt_bool("document.html.display_frames", NULL);
|
||||
doo->frames = get_opt_bool("document.html.display_frames", ses);
|
||||
doo->images = get_opt_bool("document.browse.images.show_as_links", ses);
|
||||
doo->display_subs = get_opt_bool("document.html.display_subs", NULL);
|
||||
doo->display_sups = get_opt_bool("document.html.display_sups", NULL);
|
||||
doo->display_subs = get_opt_bool("document.html.display_subs", ses);
|
||||
doo->display_sups = get_opt_bool("document.html.display_sups", ses);
|
||||
|
||||
doo->framename = "";
|
||||
|
||||
doo->image_link.prefix = "";
|
||||
doo->image_link.suffix = "";
|
||||
doo->image_link.filename_maxlen = get_opt_int("document.browse.images.filename_maxlen", NULL);
|
||||
doo->image_link.label_maxlen = get_opt_int("document.browse.images.label_maxlen", NULL);
|
||||
doo->image_link.display_style = get_opt_int("document.browse.images.display_style", NULL);
|
||||
doo->image_link.tagging = get_opt_int("document.browse.images.image_link_tagging", NULL);
|
||||
doo->image_link.show_any_as_links = get_opt_bool("document.browse.images.show_any_as_links", NULL);
|
||||
doo->image_link.filename_maxlen = get_opt_int("document.browse.images.filename_maxlen", ses);
|
||||
doo->image_link.label_maxlen = get_opt_int("document.browse.images.label_maxlen", ses);
|
||||
doo->image_link.display_style = get_opt_int("document.browse.images.display_style", ses);
|
||||
doo->image_link.tagging = get_opt_int("document.browse.images.image_link_tagging", ses);
|
||||
doo->image_link.show_any_as_links = get_opt_bool("document.browse.images.show_any_as_links", ses);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -97,7 +97,7 @@ do_document_refresh(void *data)
|
||||
void
|
||||
start_document_refresh(struct document_refresh *refresh, struct session *ses)
|
||||
{
|
||||
milliseconds_T minimum = (milliseconds_T) get_opt_int("document.browse.minimum_refresh_time", NULL);
|
||||
milliseconds_T minimum = (milliseconds_T) get_opt_int("document.browse.minimum_refresh_time", ses);
|
||||
milliseconds_T refresh_delay = sec_to_ms(refresh->seconds);
|
||||
milliseconds_T time = ms_max(refresh_delay, minimum);
|
||||
struct type_query *type_query;
|
||||
|
@ -75,7 +75,8 @@ see_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
struct SEE_interpreter *interp = &g->interp;
|
||||
|
||||
interpreter->backend_data = g;
|
||||
g->max_exec_time = get_opt_int("ecmascript.max_exec_time", NULL);
|
||||
g->max_exec_time = get_opt_int("ecmascript.max_exec_time",
|
||||
interpreter->vs->doc_view->session);
|
||||
g->exec_start = time(NULL);
|
||||
/* used by setTimeout */
|
||||
g->interpreter = interpreter;
|
||||
|
@ -251,7 +251,7 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self,
|
||||
see_check_class(interp, thisobj, &js_window_object_class);
|
||||
|
||||
SEE_SET_OBJECT(res, (struct SEE_object *)win);
|
||||
if (get_opt_bool("ecmascript.block_window_opening", NULL)) {
|
||||
if (get_opt_bool("ecmascript.block_window_opening", ses)) {
|
||||
#ifdef CONFIG_LEDS
|
||||
set_led_value(ses->status.popup_led, 'P');
|
||||
#endif
|
||||
|
@ -61,22 +61,22 @@ static void
|
||||
error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
|
||||
{
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
struct session *ses = interpreter->vs->doc_view->session;
|
||||
struct terminal *term;
|
||||
unsigned char *strict, *exception, *warning, *error;
|
||||
struct string msg;
|
||||
|
||||
assert(interpreter && interpreter->vs && interpreter->vs->doc_view
|
||||
&& interpreter->vs->doc_view->session
|
||||
&& interpreter->vs->doc_view->session->tab);
|
||||
&& ses && ses->tab);
|
||||
if_assert_failed goto reported;
|
||||
|
||||
term = interpreter->vs->doc_view->session->tab->term;
|
||||
term = ses->tab->term;
|
||||
|
||||
#ifdef CONFIG_LEDS
|
||||
set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J');
|
||||
set_led_value(ses->status.ecmascript_led, 'J');
|
||||
#endif
|
||||
|
||||
if (!get_opt_bool("ecmascript.error_reporting", NULL)
|
||||
if (!get_opt_bool("ecmascript.error_reporting", ses)
|
||||
|| !init_string(&msg))
|
||||
goto reported;
|
||||
|
||||
@ -113,10 +113,11 @@ static JSBool
|
||||
safeguard(JSContext *ctx, JSScript *script)
|
||||
{
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
int max_exec_time = get_opt_int("ecmascript.max_exec_time", NULL);
|
||||
struct session *ses = interpreter->vs->doc_view->session;
|
||||
int max_exec_time = get_opt_int("ecmascript.max_exec_time", ses);
|
||||
|
||||
if (time(NULL) - interpreter->exec_start > max_exec_time) {
|
||||
struct terminal *term = interpreter->vs->doc_view->session->tab->term;
|
||||
struct terminal *term = ses->tab->term;
|
||||
|
||||
/* A killer script! Alert! */
|
||||
ecmascript_timeout_dialog(term, max_exec_time);
|
||||
|
@ -353,7 +353,7 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
doc_view = vs->doc_view;
|
||||
ses = doc_view->session;
|
||||
|
||||
if (get_opt_bool("ecmascript.block_window_opening", NULL)) {
|
||||
if (get_opt_bool("ecmascript.block_window_opening", ses)) {
|
||||
#ifdef CONFIG_LEDS
|
||||
set_led_value(ses->status.popup_led, 'P');
|
||||
#endif
|
||||
|
@ -296,7 +296,8 @@ write_cache_entry_to_file(struct cache_entry *cached, struct file_download *file
|
||||
static void
|
||||
abort_download_and_beep(struct file_download *file_download, struct terminal *term)
|
||||
{
|
||||
if (term && get_opt_int("document.download.notify_bell", NULL)
|
||||
if (term && get_opt_int("document.download.notify_bell",
|
||||
file_download->ses)
|
||||
+ file_download->notify >= 2) {
|
||||
beep_terminal(term);
|
||||
}
|
||||
@ -403,7 +404,8 @@ download_data_store(struct download *download, struct file_download *file_downlo
|
||||
}
|
||||
|
||||
if (file_download->remotetime
|
||||
&& get_opt_bool("document.download.set_original_time", NULL)) {
|
||||
&& get_opt_bool("document.download.set_original_time",
|
||||
file_download->ses)) {
|
||||
struct utimbuf foo;
|
||||
|
||||
foo.actime = foo.modtime = file_download->remotetime;
|
||||
|
@ -132,7 +132,7 @@ ses_history_move(struct session *ses)
|
||||
|
||||
/* Maybe trash the unhistory. */
|
||||
|
||||
if (get_opt_bool("document.history.keep_unhistory", NULL))
|
||||
if (get_opt_bool("document.history.keep_unhistory", ses))
|
||||
clean_unhistory(&ses->history);
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,7 @@ doc_loading_callback(struct download *download, struct session *ses)
|
||||
if (ses->doc_view
|
||||
&& ses->doc_view->document
|
||||
&& ses->doc_view->document->refresh
|
||||
&& get_opt_bool("document.browse.refresh", NULL)) {
|
||||
&& get_opt_bool("document.browse.refresh", ses)) {
|
||||
start_document_refresh(ses->doc_view->document->refresh,
|
||||
ses);
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame,
|
||||
int referrer_incomplete = 0;
|
||||
int malicious_uri = 0;
|
||||
int confirm_submit = uri->form && get_opt_bool("document.browse.forms"
|
||||
".confirm_submit", NULL);
|
||||
".confirm_submit", ses);
|
||||
unsigned char *m1 = NULL, *message = NULL;
|
||||
|
||||
if (ses->doc_view
|
||||
@ -194,7 +194,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame,
|
||||
* posting form data so this should be more correct. */
|
||||
|
||||
if (uri->user && uri->userlen
|
||||
&& get_opt_bool("document.browse.links.warn_malicious", NULL)
|
||||
&& get_opt_bool("document.browse.links.warn_malicious", ses)
|
||||
&& check_malicious_uri(uri)) {
|
||||
malicious_uri = 1;
|
||||
confirm_submit = 1;
|
||||
@ -389,8 +389,8 @@ ses_imgmap(struct session *ses)
|
||||
&doc_view->document->options,
|
||||
ses->task.target.frame,
|
||||
get_opt_codepage_tree(ses->tab->term->spec, "charset", NULL),
|
||||
get_opt_codepage("document.codepage.assume", NULL),
|
||||
get_opt_bool("document.codepage.force_assumed", NULL)))
|
||||
get_opt_codepage("document.codepage.assume", ses),
|
||||
get_opt_bool("document.codepage.force_assumed", ses)))
|
||||
return;
|
||||
|
||||
add_empty_window(ses->tab->term, (void (*)(void *)) freeml, ml);
|
||||
@ -583,7 +583,7 @@ do_follow_url(struct session *ses, struct uri *uri, unsigned char *target,
|
||||
|
||||
if (target && !strcmp(target, "_blank")) {
|
||||
int mode = get_opt_int("document.browse.links.target_blank",
|
||||
NULL);
|
||||
ses);
|
||||
|
||||
if (mode == 3
|
||||
&& !get_cmd_opt_bool("anonymous")
|
||||
@ -754,7 +754,7 @@ goto_url_with_hook(struct session *ses, unsigned char *url)
|
||||
int
|
||||
goto_url_home(struct session *ses)
|
||||
{
|
||||
unsigned char *homepage = get_opt_str("ui.sessions.homepage", NULL);
|
||||
unsigned char *homepage = get_opt_str("ui.sessions.homepage", ses);
|
||||
|
||||
if (!*homepage) homepage = getenv("WWW_HOME");
|
||||
if (!homepage || !*homepage) homepage = WWW_HOME_URL;
|
||||
|
@ -139,7 +139,8 @@ switch_to_tab(struct terminal *term, int tab, int tabs_count)
|
||||
if (tabs_count < 0) tabs_count = number_of_tabs(term);
|
||||
|
||||
if (tabs_count > 1) {
|
||||
if (get_opt_bool("ui.tabs.wraparound", NULL)) {
|
||||
if (get_opt_bool("ui.tabs.wraparound",
|
||||
get_current_tab(term)->data)) {
|
||||
tab %= tabs_count;
|
||||
if (tab < 0) tab += tabs_count;
|
||||
} else
|
||||
@ -196,7 +197,7 @@ close_tab(struct terminal *term, struct session *ses)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_opt_bool("ui.tabs.confirm_close", NULL)) {
|
||||
if (!get_opt_bool("ui.tabs.confirm_close", ses)) {
|
||||
really_close_tab(ses);
|
||||
return;
|
||||
}
|
||||
@ -240,7 +241,7 @@ close_all_tabs_but_current(struct session *ses)
|
||||
assert(ses);
|
||||
if_assert_failed return;
|
||||
|
||||
if (!get_opt_bool("ui.tabs.confirm_close", NULL)) {
|
||||
if (!get_opt_bool("ui.tabs.confirm_close", ses)) {
|
||||
really_close_tabs(ses);
|
||||
return;
|
||||
}
|
||||
@ -309,7 +310,7 @@ move_current_tab(struct session *ses, int direction)
|
||||
|
||||
new_pos = term->current_tab + direction;
|
||||
|
||||
if (get_opt_bool("ui.tabs.wraparound", NULL)) {
|
||||
if (get_opt_bool("ui.tabs.wraparound", ses)) {
|
||||
new_pos %= tabs;
|
||||
if (new_pos < 0) new_pos = tabs + new_pos;
|
||||
} else {
|
||||
|
@ -74,7 +74,7 @@ check_document_fragment(struct session *ses, struct document_view *doc_view)
|
||||
}
|
||||
|
||||
if (get_opt_bool("document.browse.links.missing_fragment",
|
||||
NULL)) {
|
||||
ses)) {
|
||||
info_box(ses->tab->term, MSGBOX_FREE_TEXT,
|
||||
N_("Missing fragment"), ALIGN_CENTER,
|
||||
msg_text(ses->tab->term, N_("The requested fragment "
|
||||
@ -228,10 +228,10 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
|
||||
}
|
||||
}
|
||||
|
||||
color.foreground = get_opt_color("document.colors.text", NULL);
|
||||
color.foreground = get_opt_color("document.colors.text", ses);
|
||||
color.background = doc_view->document->height
|
||||
? doc_view->document->bgcolor
|
||||
: get_opt_color("document.colors.background", NULL);
|
||||
: get_opt_color("document.colors.background", ses);
|
||||
|
||||
vs = doc_view->vs;
|
||||
if (!vs) {
|
||||
@ -355,7 +355,7 @@ draw_formatted(struct session *ses, int rerender)
|
||||
if (ses->doc_view
|
||||
&& ses->doc_view->document
|
||||
&& ses->doc_view->document->refresh
|
||||
&& get_opt_bool("document.browse.refresh", NULL)) {
|
||||
&& get_opt_bool("document.browse.refresh", ses)) {
|
||||
start_document_refresh(ses->doc_view->document->refresh,
|
||||
ses);
|
||||
}
|
||||
|
@ -1198,7 +1198,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view,
|
||||
* a file that is to be uploaded. TODO: Distinguish between
|
||||
* these two classes of errors (is it worth it?). -- Miciah */
|
||||
if (data.source
|
||||
&& get_opt_bool("document.browse.forms.show_formhist", NULL))
|
||||
&& get_opt_bool("document.browse.forms.show_formhist", ses))
|
||||
memorize_form(ses, &submit, form);
|
||||
#endif
|
||||
|
||||
@ -1562,7 +1562,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
* submit the form or the posting fails. */
|
||||
/* FIXME: We should maybe have ACT_EDIT_ENTER_RELOAD */
|
||||
if ((has_form_submit(fc->form)
|
||||
&& !get_opt_bool("document.browse.forms.auto_submit", NULL))
|
||||
&& !get_opt_bool("document.browse.forms.auto_submit", ses))
|
||||
|| goto_current_link(ses, doc_view, 0)) {
|
||||
if (ses->insert_mode == INSERT_MODE_ON)
|
||||
ses->insert_mode = INSERT_MODE_OFF;
|
||||
@ -1922,7 +1922,7 @@ get_form_info(struct session *ses, struct document_view *doc_view)
|
||||
if (!fc->form->action
|
||||
|| (has_form_submit(fc->form)
|
||||
&& !get_opt_bool("document.browse.forms.auto_submit",
|
||||
NULL)))
|
||||
ses)))
|
||||
break;
|
||||
|
||||
uri = get_uri(fc->form->action, 0);
|
||||
@ -1970,7 +1970,7 @@ get_form_info(struct session *ses, struct document_view *doc_view)
|
||||
}
|
||||
|
||||
if (link->accesskey
|
||||
&& get_opt_bool("document.browse.accesskey.display", NULL)) {
|
||||
&& get_opt_bool("document.browse.accesskey.display", ses)) {
|
||||
add_to_string(&str, " (");
|
||||
add_accesskey_to_string(&str, link->accesskey);
|
||||
add_char_to_string(&str, ')');
|
||||
|
@ -1171,7 +1171,7 @@ goto_link_number_do(struct session *ses, struct document_view *doc_view, int n)
|
||||
|
||||
link = &doc_view->document->links[n];
|
||||
if (!link_is_textinput(link)
|
||||
&& get_opt_bool("document.browse.accesskey.auto_follow", NULL))
|
||||
&& get_opt_bool("document.browse.accesskey.auto_follow", ses))
|
||||
enter(ses, doc_view, 0);
|
||||
}
|
||||
|
||||
@ -1456,7 +1456,7 @@ get_current_link_info(struct session *ses, struct document_view *doc_view)
|
||||
add_string_uri_to_string(&str, uristring, URI_PUBLIC);
|
||||
if (link->accesskey > 0
|
||||
&& get_opt_bool("document.browse.accesskey.display",
|
||||
NULL)) {
|
||||
ses)) {
|
||||
add_to_string(&str, " (");
|
||||
add_accesskey_to_string(&str, link->accesskey);
|
||||
add_char_to_string(&str, ')');
|
||||
|
@ -181,7 +181,7 @@ move_link(struct session *ses, struct document_view *doc_view, int direction,
|
||||
} else {
|
||||
/* We only bother this option if there's some links
|
||||
* in document. */
|
||||
wraparound = get_opt_bool("document.browse.links.wraparound", NULL);
|
||||
wraparound = get_opt_bool("document.browse.links.wraparound", ses);
|
||||
}
|
||||
|
||||
count = eat_kbd_repeat_count(ses);
|
||||
@ -309,7 +309,7 @@ horizontal_scroll(struct session *ses, struct document_view *doc_view, int steps
|
||||
|
||||
x = doc_view->vs->x + steps;
|
||||
|
||||
if (get_opt_bool("document.browse.scrolling.horizontal_extended", NULL)) {
|
||||
if (get_opt_bool("document.browse.scrolling.horizontal_extended", ses)) {
|
||||
max = doc_view->document->width - 1;
|
||||
} else {
|
||||
max = int_max(doc_view->vs->x,
|
||||
@ -335,7 +335,7 @@ scroll_up(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step", ses);
|
||||
|
||||
return vertical_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -346,7 +346,7 @@ scroll_down(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step", ses);
|
||||
|
||||
return vertical_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -357,7 +357,7 @@ scroll_left(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step", ses);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -368,7 +368,7 @@ scroll_right(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step", ses);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -377,7 +377,7 @@ scroll_right(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_up(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step", ses);
|
||||
|
||||
return vertical_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -385,7 +385,7 @@ scroll_mouse_up(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_down(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step", ses);
|
||||
|
||||
return vertical_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -393,7 +393,7 @@ scroll_mouse_down(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_left(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step", ses);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -401,7 +401,7 @@ scroll_mouse_left(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_right(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step", ses);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -808,7 +808,7 @@ frame_ev_kbd(struct session *ses, struct document_view *doc_view, struct term_ev
|
||||
if (status != FRAME_EVENT_IGNORED)
|
||||
return status;
|
||||
#endif
|
||||
accesskey_priority = get_opt_int("document.browse.accesskey.priority", NULL);
|
||||
accesskey_priority = get_opt_int("document.browse.accesskey.priority", ses);
|
||||
|
||||
if (accesskey_priority >= 2) {
|
||||
status = try_document_key(ses, doc_view, ev);
|
||||
@ -886,7 +886,7 @@ frame_ev_mouse(struct session *ses, struct document_view *doc_view, struct term_
|
||||
if (check_mouse_button(ev, B_LEFT)) {
|
||||
/* Clicking the edge of screen will scroll the document. */
|
||||
|
||||
int scrollmargin = get_opt_int("document.browse.scrolling.margin", NULL);
|
||||
int scrollmargin = get_opt_int("document.browse.scrolling.margin", ses);
|
||||
|
||||
/* XXX: This is code duplication with kbd handlers. But
|
||||
* repeatcount-free here. */
|
||||
@ -1118,7 +1118,7 @@ static void
|
||||
try_typeahead(struct session *ses, struct document_view *doc_view,
|
||||
struct term_event *ev, enum main_action action_id)
|
||||
{
|
||||
switch (get_opt_int("document.browse.search.typeahead", NULL)) {
|
||||
switch (get_opt_int("document.browse.search.typeahead", ses)) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
@ -1195,7 +1195,7 @@ quit:
|
||||
|
||||
if (doc_view
|
||||
&& get_opt_int("document.browse.accesskey"
|
||||
".priority", NULL) <= 0
|
||||
".priority", ses) <= 0
|
||||
&& try_document_key(ses, doc_view, ev)
|
||||
== FRAME_EVENT_REFRESH) {
|
||||
/* The document ate the key! */
|
||||
|
Loading…
Reference in New Issue
Block a user