1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

send_kbd_event: Fix accesskeys when priority = 0

With document.browse.accesskey.priority = 0, accesskeys were ignored if
the current tab was not the last (rightmost) tab.  This commit fixes the
problem.

Add a function tabs_are_on_top(struct terminal *) which returns
a Boolean value indicating whether the topmost window is a tab (as
opposed to, e.g., a menu).

This commit fixes commit 1bd498cde9.
This commit is contained in:
Miciah Dashiel Butler Masters 2011-01-19 03:33:00 +00:00
parent fd02d71178
commit af5e54d95f
3 changed files with 15 additions and 1 deletions

View File

@ -61,6 +61,16 @@ found_pos:
return win;
}
/** If the topmost window is a tab, return 1; else, return 0. */
NONSTATIC_INLINE int
tabs_are_on_top(struct terminal *term)
{
if (list_empty(term->windows))
return 0;
return ((struct window *) term->windows.next)->type == WINDOW_TAB;
}
/** Number of tabs at the terminal (in term->windows) */
NONSTATIC_INLINE int
number_of_tabs(struct terminal *term)

View File

@ -10,6 +10,7 @@ struct uri;
struct window *
init_tab(struct terminal *term, void *data, window_handler_T handler);
int tabs_are_on_top(struct terminal *);
int number_of_tabs(struct terminal *);
int get_tab_number(struct window *);
int get_tab_number_by_xpos(struct terminal *term, int xpos);

View File

@ -1525,8 +1525,11 @@ quit:
deselect_mainmenu(win->term, win->data);
print_screen_status(ses);
}
if (ses->tab != ses->tab->term->windows.next)
if (!tabs_are_on_top(ses->tab->term)) {
/* The event opened a menu; we're done. */
return NULL;
}
/* Otherwise, the event still needs to be handled. */
get_kbd_modifier(ev) |= KBD_MOD_ALT;
if (doc_view