static int max_frame_cols;
+static Lisp_Object Qtty_mode_set_strings;
+static Lisp_Object Qtty_mode_reset_strings;
+
\f
#ifdef HAVE_GPM
/* Set up termcap modes for Emacs. */
+static void
+tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym)
+{
+ Lisp_Object lisp_terminal;
+ Lisp_Object extra_codes;
+ struct tty_display_info *tty = terminal->display_info.tty;
+
+ XSETTERMINAL (lisp_terminal, terminal);
+ for (extra_codes = Fterminal_parameter (lisp_terminal, sym);
+ CONSP (extra_codes);
+ extra_codes = XCDR (extra_codes))
+ {
+ Lisp_Object string = XCAR (extra_codes);
+ if (STRINGP (string))
+ {
+ fwrite (SDATA (string), 1, SBYTES (string), tty->output);
+ if (tty->termscript)
+ fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
+ }
+ }
+}
+
static void
tty_set_terminal_modes (struct terminal *terminal)
{
OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal);
OUTPUT_IF (tty, tty->TS_keypad_mode);
losecursor (tty);
+ tty_send_additional_strings (terminal, Qtty_mode_set_strings);
fflush (tty->output);
}
}
if (tty->output)
{
+ tty_send_additional_strings (terminal, Qtty_mode_reset_strings);
tty_turn_off_highlight (tty);
tty_turn_off_insert (tty);
OUTPUT_IF (tty, tty->TS_end_keypad_mode);
menu_help_paneno = pn - 1;
menu_help_itemno = j;
}
+ /* Take note of the coordinates of the active menu item, to
+ display the cursor there. */
+ if (mousehere)
+ {
+ row = y + i;
+ col = x;
+ }
display_tty_menu_item (menu->text[j], max_width, face, x, y + i,
menu->submenu[j] != NULL);
}
bool first_time;
Lisp_Object selectface;
int first_item = 0;
+ int col, row;
/* Don't allow non-positive x0 and y0, lest the menu will wrap
around the display. */
/* Turn off the cursor. Otherwise it shows through the menu
panes, which is ugly. */
+ col = cursorX (tty);
+ row = cursorY (tty);
tty_hide_cursor (tty);
+
if (buffers_num_deleted)
menu->text[0][7] = ' ';
onepane = menu->count == 1 && menu->submenu[0];
faces, x, y, first_item, 1);
tty_hide_cursor (tty);
fflush (tty->output);
+ /* The call to display help-echo below will move the cursor,
+ so remember its current position as computed by
+ tty_menu_display. */
+ col = cursorX (tty);
+ row = cursorY (tty);
}
/* Display the help-echo message for the currently-selected menu
{
help_callback (menu_help_message,
menu_help_paneno, menu_help_itemno);
+ /* Move the cursor to the beginning of the current menu
+ item, so that screen readers and other accessibility aids
+ know where the active region is. */
+ cursor_to (sf, row, col);
tty_hide_cursor (tty);
fflush (tty->output);
prev_menu_help_message = menu_help_message;
static void
set_tty_hooks (struct terminal *terminal)
{
- terminal->rif = 0; /* ttys don't support window-based redisplay. */
-
terminal->cursor_to_hook = &tty_cursor_to;
terminal->raw_cursor_to_hook = &tty_raw_cursor_to;
-
terminal->clear_to_end_hook = &tty_clear_to_end;
terminal->clear_frame_hook = &tty_clear_frame;
terminal->clear_end_of_line_hook = &tty_clear_end_of_line;
-
terminal->ins_del_lines_hook = &tty_ins_del_lines;
-
terminal->insert_glyphs_hook = &tty_insert_glyphs;
terminal->write_glyphs_hook = &tty_write_glyphs;
terminal->delete_glyphs_hook = &tty_delete_glyphs;
-
terminal->ring_bell_hook = &tty_ring_bell;
-
terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes;
terminal->set_terminal_modes_hook = &tty_set_terminal_modes;
- terminal->update_begin_hook = 0; /* Not needed. */
terminal->update_end_hook = &tty_update_end;
terminal->set_terminal_window_hook = &tty_set_terminal_window;
-
- terminal->mouse_position_hook = 0; /* Not needed. */
- terminal->frame_rehighlight_hook = 0; /* Not needed. */
- terminal->frame_raise_lower_hook = 0; /* Not needed. */
-
- terminal->set_vertical_scroll_bar_hook = 0; /* Not needed. */
- terminal->condemn_scroll_bars_hook = 0; /* Not needed. */
- terminal->redeem_scroll_bar_hook = 0; /* Not needed. */
- terminal->judge_scroll_bars_hook = 0; /* Not needed. */
-
terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
- terminal->frame_up_to_date_hook = 0; /* Not needed. */
-
terminal->delete_frame_hook = &tty_free_frame_resources;
terminal->delete_terminal_hook = &delete_tty;
+ /* Other hooks are NULL by default. */
}
/* If FD is the controlling terminal, drop it. */
if (terminal)
return terminal;
- terminal = create_terminal ();
+ terminal = create_terminal (output_termcap, NULL);
#ifdef MSDOS
if (been_here > 0)
maybe_fatal (0, 0, "Attempt to create another terminal %s", "",
tty->next = tty_list;
tty_list = tty;
- terminal->type = output_termcap;
terminal->display_info.tty = tty;
tty->terminal = terminal;
encode_terminal_src = NULL;
encode_terminal_dst = NULL;
+ DEFSYM (Qtty_mode_set_strings, "tty-mode-set-strings");
+ DEFSYM (Qtty_mode_reset_strings, "tty-mode-reset-strings");
+
#ifndef MSDOS
DEFSYM (Qtty_menu_next_item, "tty-menu-next-item");
DEFSYM (Qtty_menu_prev_item, "tty-menu-prev-item");