* termhooks.h (create_terminal): Adjust prototype.
* terminal.c (create_terminal): Pass output method and RIF as args.
(init_initial_terminal):
* nsterm.m (ns_create_terminal):
* term.c (init_tty):
* w32term.c (w32_create_terminal):
* xterm.c (x_create_terminal): Adjust users.
Avoid redundant NULL initializers and add comments.
+2014-05-14 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Minor cleanup for terminal setup.
+ * termhooks.h (create_terminal): Adjust prototype.
+ * terminal.c (create_terminal): Pass output method and RIF as args.
+ (init_initial_terminal):
+ * nsterm.m (ns_create_terminal):
+ * term.c (init_tty):
+ * w32term.c (w32_create_terminal):
+ * xterm.c (x_create_terminal): Adjust users.
+ Avoid redundant NULL initializers and add comments.
+
2014-05-13 Paul Eggert <eggert@cs.ucla.edu>
* keyboard.c (Qdeactivate_mark): Now static.
NSTRACE (ns_create_terminal);
- terminal = create_terminal ();
+ terminal = create_terminal (output_ns, &ns_redisplay_interface);
- terminal->type = output_ns;
terminal->display_info.ns = dpyinfo;
dpyinfo->terminal = terminal;
- terminal->rif = &ns_redisplay_interface;
-
terminal->clear_frame_hook = ns_clear_frame;
- terminal->ins_del_lines_hook = 0; /* XXX vestigial? */
- terminal->delete_glyphs_hook = 0; /* XXX vestigial? */
terminal->ring_bell_hook = ns_ring_bell;
- terminal->reset_terminal_modes_hook = NULL;
- terminal->set_terminal_modes_hook = NULL;
terminal->update_begin_hook = ns_update_begin;
terminal->update_end_hook = ns_update_end;
- terminal->set_terminal_window_hook = NULL; /* XXX vestigial? */
terminal->read_socket_hook = ns_read_socket;
terminal->frame_up_to_date_hook = ns_frame_up_to_date;
terminal->mouse_position_hook = ns_mouse_position;
terminal->frame_rehighlight_hook = ns_frame_rehighlight;
terminal->frame_raise_lower_hook = ns_frame_raise_lower;
-
terminal->fullscreen_hook = ns_fullscreen_hook;
-
terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar;
terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars;
terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar;
terminal->judge_scroll_bars_hook = ns_judge_scroll_bars;
-
terminal->delete_frame_hook = x_destroy_window;
terminal->delete_terminal_hook = ns_delete_terminal;
+ /* Other hooks are NULL by default. */
return terminal;
}
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;
#endif
extern struct terminal *get_terminal (Lisp_Object terminal, bool);
-extern struct terminal *create_terminal (void);
+extern struct terminal *create_terminal (enum output_method,
+ struct redisplay_interface *);
extern void delete_terminal (struct terminal *);
/* The initial terminal device, created by initial_term_init. */
return result;
}
-\f
-
-/* Create a new terminal object and add it to the terminal list. */
+/* Create a new terminal object of TYPE and add it to the terminal list. RIF
+ may be NULL if this terminal type doesn't support window-based redisplay. */
struct terminal *
-create_terminal (void)
+create_terminal (enum output_method type, struct redisplay_interface *rif)
{
struct terminal *terminal = allocate_terminal ();
Lisp_Object terminal_coding, keyboard_coding;
terminal->next_terminal = terminal_list;
terminal_list = terminal;
-
+ terminal->type = type;
+ terminal->rif = rif;
terminal->id = next_terminal_id++;
terminal->keyboard_coding = xmalloc (sizeof (struct coding_system));
if (initialized || terminal_list || tty_list)
emacs_abort ();
- initial_terminal = create_terminal ();
- initial_terminal->type = output_initial;
+ initial_terminal = create_terminal (output_initial, NULL);
initial_terminal->name = xstrdup ("initial_terminal");
initial_terminal->kboard = initial_kboard;
initial_terminal->delete_terminal_hook = &delete_initial_terminal;
initial_terminal->delete_frame_hook = &initial_free_frame_resources;
- /* All other hooks are NULL. */
+ /* Other hooks are NULL by default. */
return initial_terminal;
}
{
struct terminal *terminal;
- terminal = create_terminal ();
+ terminal = create_terminal (output_w32, &w32_redisplay_interface);
- terminal->type = output_w32;
terminal->display_info.w32 = dpyinfo;
dpyinfo->terminal = terminal;
terminal->ins_del_lines_hook = x_ins_del_lines;
terminal->delete_glyphs_hook = x_delete_glyphs;
terminal->ring_bell_hook = w32_ring_bell;
- terminal->reset_terminal_modes_hook = NULL;
- terminal->set_terminal_modes_hook = NULL;
terminal->update_begin_hook = x_update_begin;
terminal->update_end_hook = x_update_end;
- terminal->set_terminal_window_hook = NULL;
terminal->read_socket_hook = w32_read_socket;
terminal->frame_up_to_date_hook = w32_frame_up_to_date;
terminal->mouse_position_hook = w32_mouse_position;
terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars;
terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar;
terminal->judge_scroll_bars_hook = w32_judge_scroll_bars;
-
terminal->delete_frame_hook = x_destroy_window;
terminal->delete_terminal_hook = x_delete_terminal;
-
- terminal->rif = &w32_redisplay_interface;
+ /* Other hooks are NULL by default. */
/* We don't yet support separate terminals on W32, so don't try to share
keyboards between virtual terminals that are on the same physical
{
struct terminal *terminal;
- terminal = create_terminal ();
+ terminal = create_terminal (output_x_window, &x_redisplay_interface);
- terminal->type = output_x_window;
terminal->display_info.x = dpyinfo;
dpyinfo->terminal = terminal;
terminal->delete_glyphs_hook = x_delete_glyphs;
terminal->ring_bell_hook = XTring_bell;
terminal->toggle_invisible_pointer_hook = XTtoggle_invisible_pointer;
- terminal->reset_terminal_modes_hook = NULL;
- terminal->set_terminal_modes_hook = NULL;
terminal->update_begin_hook = x_update_begin;
terminal->update_end_hook = x_update_end;
- terminal->set_terminal_window_hook = NULL;
terminal->read_socket_hook = XTread_socket;
terminal->frame_up_to_date_hook = XTframe_up_to_date;
terminal->mouse_position_hook = XTmouse_position;
terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars;
terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar;
terminal->judge_scroll_bars_hook = XTjudge_scroll_bars;
-
terminal->delete_frame_hook = x_destroy_window;
terminal->delete_terminal_hook = x_delete_terminal;
-
- terminal->rif = &x_redisplay_interface;
+ /* Other hooks are NULL by default. */
return terminal;
}