From: Dmitry Antipov Date: Wed, 14 May 2014 13:55:37 +0000 (+0400) Subject: Minor cleanup for terminal setup. X-Git-Tag: emacs-25.0.90~2640^2~105 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6f1d9822d972c418dbf2295fcd01b7b0a3dc5ef8;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 587efbd79f6..e78a32c26ca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2014-05-14 Dmitry Antipov + + 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 * keyboard.c (Qdeactivate_mark): Now static. diff --git a/src/nsterm.m b/src/nsterm.m index 842ff194c40..17014b97121 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4153,38 +4153,28 @@ ns_create_terminal (struct ns_display_info *dpyinfo) 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; } diff --git a/src/term.c b/src/term.c index 8ea3e42dae6..379c94e54a1 100644 --- a/src/term.c +++ b/src/term.c @@ -3940,43 +3940,24 @@ clear_tty_hooks (struct terminal *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. */ @@ -4040,7 +4021,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) 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", "", @@ -4054,7 +4035,6 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) tty->next = tty_list; tty_list = tty; - terminal->type = output_termcap; terminal->display_info.tty = tty; tty->terminal = terminal; diff --git a/src/termhooks.h b/src/termhooks.h index 708351da83d..207b8ccbc3c 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -637,7 +637,8 @@ extern struct terminal *terminal_list; #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. */ diff --git a/src/terminal.c b/src/terminal.c index d0a38b97bb4..23455262cb3 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -224,19 +224,19 @@ get_terminal (Lisp_Object terminal, bool throw) return result; } - - -/* 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)); @@ -519,13 +519,12 @@ init_initial_terminal (void) 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; } diff --git a/src/w32term.c b/src/w32term.c index 3aabf92357a..aa65af4afd3 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6272,9 +6272,8 @@ w32_create_terminal (struct w32_display_info *dpyinfo) { 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; @@ -6284,11 +6283,8 @@ w32_create_terminal (struct w32_display_info *dpyinfo) 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; @@ -6299,11 +6295,9 @@ w32_create_terminal (struct w32_display_info *dpyinfo) 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 diff --git a/src/xterm.c b/src/xterm.c index 5c21bfae144..0693d101f16 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10526,9 +10526,8 @@ x_create_terminal (struct x_display_info *dpyinfo) { 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; @@ -10539,11 +10538,8 @@ x_create_terminal (struct x_display_info *dpyinfo) 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; @@ -10554,11 +10550,9 @@ x_create_terminal (struct x_display_info *dpyinfo) 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; }