aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2014-05-14 17:55:37 +0400
committerDmitry Antipov2014-05-14 17:55:37 +0400
commit6f1d9822d972c418dbf2295fcd01b7b0a3dc5ef8 (patch)
tree18e260eef312d3459cb0908206bbfa621cf66808
parentc5aed7bd9330c2bde33abfe1724af820273b457a (diff)
downloademacs-6f1d9822d972c418dbf2295fcd01b7b0a3dc5ef8.tar.gz
emacs-6f1d9822d972c418dbf2295fcd01b7b0a3dc5ef8.zip
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.
-rw-r--r--src/ChangeLog12
-rw-r--r--src/nsterm.m14
-rw-r--r--src/term.c24
-rw-r--r--src/termhooks.h3
-rw-r--r--src/terminal.c15
-rw-r--r--src/w32term.c10
-rw-r--r--src/xterm.c10
7 files changed, 29 insertions, 59 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 587efbd79f6..e78a32c26ca 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12014-05-14 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Minor cleanup for terminal setup.
4 * termhooks.h (create_terminal): Adjust prototype.
5 * terminal.c (create_terminal): Pass output method and RIF as args.
6 (init_initial_terminal):
7 * nsterm.m (ns_create_terminal):
8 * term.c (init_tty):
9 * w32term.c (w32_create_terminal):
10 * xterm.c (x_create_terminal): Adjust users.
11 Avoid redundant NULL initializers and add comments.
12
12014-05-13 Paul Eggert <eggert@cs.ucla.edu> 132014-05-13 Paul Eggert <eggert@cs.ucla.edu>
2 14
3 * keyboard.c (Qdeactivate_mark): Now static. 15 * 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)
4153 4153
4154 NSTRACE (ns_create_terminal); 4154 NSTRACE (ns_create_terminal);
4155 4155
4156 terminal = create_terminal (); 4156 terminal = create_terminal (output_ns, &ns_redisplay_interface);
4157 4157
4158 terminal->type = output_ns;
4159 terminal->display_info.ns = dpyinfo; 4158 terminal->display_info.ns = dpyinfo;
4160 dpyinfo->terminal = terminal; 4159 dpyinfo->terminal = terminal;
4161 4160
4162 terminal->rif = &ns_redisplay_interface;
4163
4164 terminal->clear_frame_hook = ns_clear_frame; 4161 terminal->clear_frame_hook = ns_clear_frame;
4165 terminal->ins_del_lines_hook = 0; /* XXX vestigial? */
4166 terminal->delete_glyphs_hook = 0; /* XXX vestigial? */
4167 terminal->ring_bell_hook = ns_ring_bell; 4162 terminal->ring_bell_hook = ns_ring_bell;
4168 terminal->reset_terminal_modes_hook = NULL;
4169 terminal->set_terminal_modes_hook = NULL;
4170 terminal->update_begin_hook = ns_update_begin; 4163 terminal->update_begin_hook = ns_update_begin;
4171 terminal->update_end_hook = ns_update_end; 4164 terminal->update_end_hook = ns_update_end;
4172 terminal->set_terminal_window_hook = NULL; /* XXX vestigial? */
4173 terminal->read_socket_hook = ns_read_socket; 4165 terminal->read_socket_hook = ns_read_socket;
4174 terminal->frame_up_to_date_hook = ns_frame_up_to_date; 4166 terminal->frame_up_to_date_hook = ns_frame_up_to_date;
4175 terminal->mouse_position_hook = ns_mouse_position; 4167 terminal->mouse_position_hook = ns_mouse_position;
4176 terminal->frame_rehighlight_hook = ns_frame_rehighlight; 4168 terminal->frame_rehighlight_hook = ns_frame_rehighlight;
4177 terminal->frame_raise_lower_hook = ns_frame_raise_lower; 4169 terminal->frame_raise_lower_hook = ns_frame_raise_lower;
4178
4179 terminal->fullscreen_hook = ns_fullscreen_hook; 4170 terminal->fullscreen_hook = ns_fullscreen_hook;
4180
4181 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; 4171 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar;
4182 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; 4172 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars;
4183 terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar; 4173 terminal->redeem_scroll_bar_hook = ns_redeem_scroll_bar;
4184 terminal->judge_scroll_bars_hook = ns_judge_scroll_bars; 4174 terminal->judge_scroll_bars_hook = ns_judge_scroll_bars;
4185
4186 terminal->delete_frame_hook = x_destroy_window; 4175 terminal->delete_frame_hook = x_destroy_window;
4187 terminal->delete_terminal_hook = ns_delete_terminal; 4176 terminal->delete_terminal_hook = ns_delete_terminal;
4177 /* Other hooks are NULL by default. */
4188 4178
4189 return terminal; 4179 return terminal;
4190} 4180}
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)
3940static void 3940static void
3941set_tty_hooks (struct terminal *terminal) 3941set_tty_hooks (struct terminal *terminal)
3942{ 3942{
3943 terminal->rif = 0; /* ttys don't support window-based redisplay. */
3944
3945 terminal->cursor_to_hook = &tty_cursor_to; 3943 terminal->cursor_to_hook = &tty_cursor_to;
3946 terminal->raw_cursor_to_hook = &tty_raw_cursor_to; 3944 terminal->raw_cursor_to_hook = &tty_raw_cursor_to;
3947
3948 terminal->clear_to_end_hook = &tty_clear_to_end; 3945 terminal->clear_to_end_hook = &tty_clear_to_end;
3949 terminal->clear_frame_hook = &tty_clear_frame; 3946 terminal->clear_frame_hook = &tty_clear_frame;
3950 terminal->clear_end_of_line_hook = &tty_clear_end_of_line; 3947 terminal->clear_end_of_line_hook = &tty_clear_end_of_line;
3951
3952 terminal->ins_del_lines_hook = &tty_ins_del_lines; 3948 terminal->ins_del_lines_hook = &tty_ins_del_lines;
3953
3954 terminal->insert_glyphs_hook = &tty_insert_glyphs; 3949 terminal->insert_glyphs_hook = &tty_insert_glyphs;
3955 terminal->write_glyphs_hook = &tty_write_glyphs; 3950 terminal->write_glyphs_hook = &tty_write_glyphs;
3956 terminal->delete_glyphs_hook = &tty_delete_glyphs; 3951 terminal->delete_glyphs_hook = &tty_delete_glyphs;
3957
3958 terminal->ring_bell_hook = &tty_ring_bell; 3952 terminal->ring_bell_hook = &tty_ring_bell;
3959
3960 terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes; 3953 terminal->reset_terminal_modes_hook = &tty_reset_terminal_modes;
3961 terminal->set_terminal_modes_hook = &tty_set_terminal_modes; 3954 terminal->set_terminal_modes_hook = &tty_set_terminal_modes;
3962 terminal->update_begin_hook = 0; /* Not needed. */
3963 terminal->update_end_hook = &tty_update_end; 3955 terminal->update_end_hook = &tty_update_end;
3964 terminal->set_terminal_window_hook = &tty_set_terminal_window; 3956 terminal->set_terminal_window_hook = &tty_set_terminal_window;
3965
3966 terminal->mouse_position_hook = 0; /* Not needed. */
3967 terminal->frame_rehighlight_hook = 0; /* Not needed. */
3968 terminal->frame_raise_lower_hook = 0; /* Not needed. */
3969
3970 terminal->set_vertical_scroll_bar_hook = 0; /* Not needed. */
3971 terminal->condemn_scroll_bars_hook = 0; /* Not needed. */
3972 terminal->redeem_scroll_bar_hook = 0; /* Not needed. */
3973 terminal->judge_scroll_bars_hook = 0; /* Not needed. */
3974
3975 terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ 3957 terminal->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
3976 terminal->frame_up_to_date_hook = 0; /* Not needed. */
3977
3978 terminal->delete_frame_hook = &tty_free_frame_resources; 3958 terminal->delete_frame_hook = &tty_free_frame_resources;
3979 terminal->delete_terminal_hook = &delete_tty; 3959 terminal->delete_terminal_hook = &delete_tty;
3960 /* Other hooks are NULL by default. */
3980} 3961}
3981 3962
3982/* If FD is the controlling terminal, drop it. */ 3963/* If FD is the controlling terminal, drop it. */
@@ -4040,7 +4021,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
4040 if (terminal) 4021 if (terminal)
4041 return terminal; 4022 return terminal;
4042 4023
4043 terminal = create_terminal (); 4024 terminal = create_terminal (output_termcap, NULL);
4044#ifdef MSDOS 4025#ifdef MSDOS
4045 if (been_here > 0) 4026 if (been_here > 0)
4046 maybe_fatal (0, 0, "Attempt to create another terminal %s", "", 4027 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)
4054 tty->next = tty_list; 4035 tty->next = tty_list;
4055 tty_list = tty; 4036 tty_list = tty;
4056 4037
4057 terminal->type = output_termcap;
4058 terminal->display_info.tty = tty; 4038 terminal->display_info.tty = tty;
4059 tty->terminal = terminal; 4039 tty->terminal = terminal;
4060 4040
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;
637#endif 637#endif
638 638
639extern struct terminal *get_terminal (Lisp_Object terminal, bool); 639extern struct terminal *get_terminal (Lisp_Object terminal, bool);
640extern struct terminal *create_terminal (void); 640extern struct terminal *create_terminal (enum output_method,
641 struct redisplay_interface *);
641extern void delete_terminal (struct terminal *); 642extern void delete_terminal (struct terminal *);
642 643
643/* The initial terminal device, created by initial_term_init. */ 644/* 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)
224 return result; 224 return result;
225} 225}
226 226
227 227/* Create a new terminal object of TYPE and add it to the terminal list. RIF
228 228 may be NULL if this terminal type doesn't support window-based redisplay. */
229/* Create a new terminal object and add it to the terminal list. */
230 229
231struct terminal * 230struct terminal *
232create_terminal (void) 231create_terminal (enum output_method type, struct redisplay_interface *rif)
233{ 232{
234 struct terminal *terminal = allocate_terminal (); 233 struct terminal *terminal = allocate_terminal ();
235 Lisp_Object terminal_coding, keyboard_coding; 234 Lisp_Object terminal_coding, keyboard_coding;
236 235
237 terminal->next_terminal = terminal_list; 236 terminal->next_terminal = terminal_list;
238 terminal_list = terminal; 237 terminal_list = terminal;
239 238 terminal->type = type;
239 terminal->rif = rif;
240 terminal->id = next_terminal_id++; 240 terminal->id = next_terminal_id++;
241 241
242 terminal->keyboard_coding = xmalloc (sizeof (struct coding_system)); 242 terminal->keyboard_coding = xmalloc (sizeof (struct coding_system));
@@ -519,13 +519,12 @@ init_initial_terminal (void)
519 if (initialized || terminal_list || tty_list) 519 if (initialized || terminal_list || tty_list)
520 emacs_abort (); 520 emacs_abort ();
521 521
522 initial_terminal = create_terminal (); 522 initial_terminal = create_terminal (output_initial, NULL);
523 initial_terminal->type = output_initial;
524 initial_terminal->name = xstrdup ("initial_terminal"); 523 initial_terminal->name = xstrdup ("initial_terminal");
525 initial_terminal->kboard = initial_kboard; 524 initial_terminal->kboard = initial_kboard;
526 initial_terminal->delete_terminal_hook = &delete_initial_terminal; 525 initial_terminal->delete_terminal_hook = &delete_initial_terminal;
527 initial_terminal->delete_frame_hook = &initial_free_frame_resources; 526 initial_terminal->delete_frame_hook = &initial_free_frame_resources;
528 /* All other hooks are NULL. */ 527 /* Other hooks are NULL by default. */
529 528
530 return initial_terminal; 529 return initial_terminal;
531} 530}
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)
6272{ 6272{
6273 struct terminal *terminal; 6273 struct terminal *terminal;
6274 6274
6275 terminal = create_terminal (); 6275 terminal = create_terminal (output_w32, &w32_redisplay_interface);
6276 6276
6277 terminal->type = output_w32;
6278 terminal->display_info.w32 = dpyinfo; 6277 terminal->display_info.w32 = dpyinfo;
6279 dpyinfo->terminal = terminal; 6278 dpyinfo->terminal = terminal;
6280 6279
@@ -6284,11 +6283,8 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6284 terminal->ins_del_lines_hook = x_ins_del_lines; 6283 terminal->ins_del_lines_hook = x_ins_del_lines;
6285 terminal->delete_glyphs_hook = x_delete_glyphs; 6284 terminal->delete_glyphs_hook = x_delete_glyphs;
6286 terminal->ring_bell_hook = w32_ring_bell; 6285 terminal->ring_bell_hook = w32_ring_bell;
6287 terminal->reset_terminal_modes_hook = NULL;
6288 terminal->set_terminal_modes_hook = NULL;
6289 terminal->update_begin_hook = x_update_begin; 6286 terminal->update_begin_hook = x_update_begin;
6290 terminal->update_end_hook = x_update_end; 6287 terminal->update_end_hook = x_update_end;
6291 terminal->set_terminal_window_hook = NULL;
6292 terminal->read_socket_hook = w32_read_socket; 6288 terminal->read_socket_hook = w32_read_socket;
6293 terminal->frame_up_to_date_hook = w32_frame_up_to_date; 6289 terminal->frame_up_to_date_hook = w32_frame_up_to_date;
6294 terminal->mouse_position_hook = w32_mouse_position; 6290 terminal->mouse_position_hook = w32_mouse_position;
@@ -6299,11 +6295,9 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6299 terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars; 6295 terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars;
6300 terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; 6296 terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar;
6301 terminal->judge_scroll_bars_hook = w32_judge_scroll_bars; 6297 terminal->judge_scroll_bars_hook = w32_judge_scroll_bars;
6302
6303 terminal->delete_frame_hook = x_destroy_window; 6298 terminal->delete_frame_hook = x_destroy_window;
6304 terminal->delete_terminal_hook = x_delete_terminal; 6299 terminal->delete_terminal_hook = x_delete_terminal;
6305 6300 /* Other hooks are NULL by default. */
6306 terminal->rif = &w32_redisplay_interface;
6307 6301
6308 /* We don't yet support separate terminals on W32, so don't try to share 6302 /* We don't yet support separate terminals on W32, so don't try to share
6309 keyboards between virtual terminals that are on the same physical 6303 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)
10526{ 10526{
10527 struct terminal *terminal; 10527 struct terminal *terminal;
10528 10528
10529 terminal = create_terminal (); 10529 terminal = create_terminal (output_x_window, &x_redisplay_interface);
10530 10530
10531 terminal->type = output_x_window;
10532 terminal->display_info.x = dpyinfo; 10531 terminal->display_info.x = dpyinfo;
10533 dpyinfo->terminal = terminal; 10532 dpyinfo->terminal = terminal;
10534 10533
@@ -10539,11 +10538,8 @@ x_create_terminal (struct x_display_info *dpyinfo)
10539 terminal->delete_glyphs_hook = x_delete_glyphs; 10538 terminal->delete_glyphs_hook = x_delete_glyphs;
10540 terminal->ring_bell_hook = XTring_bell; 10539 terminal->ring_bell_hook = XTring_bell;
10541 terminal->toggle_invisible_pointer_hook = XTtoggle_invisible_pointer; 10540 terminal->toggle_invisible_pointer_hook = XTtoggle_invisible_pointer;
10542 terminal->reset_terminal_modes_hook = NULL;
10543 terminal->set_terminal_modes_hook = NULL;
10544 terminal->update_begin_hook = x_update_begin; 10541 terminal->update_begin_hook = x_update_begin;
10545 terminal->update_end_hook = x_update_end; 10542 terminal->update_end_hook = x_update_end;
10546 terminal->set_terminal_window_hook = NULL;
10547 terminal->read_socket_hook = XTread_socket; 10543 terminal->read_socket_hook = XTread_socket;
10548 terminal->frame_up_to_date_hook = XTframe_up_to_date; 10544 terminal->frame_up_to_date_hook = XTframe_up_to_date;
10549 terminal->mouse_position_hook = XTmouse_position; 10545 terminal->mouse_position_hook = XTmouse_position;
@@ -10554,11 +10550,9 @@ x_create_terminal (struct x_display_info *dpyinfo)
10554 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; 10550 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars;
10555 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; 10551 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar;
10556 terminal->judge_scroll_bars_hook = XTjudge_scroll_bars; 10552 terminal->judge_scroll_bars_hook = XTjudge_scroll_bars;
10557
10558 terminal->delete_frame_hook = x_destroy_window; 10553 terminal->delete_frame_hook = x_destroy_window;
10559 terminal->delete_terminal_hook = x_delete_terminal; 10554 terminal->delete_terminal_hook = x_delete_terminal;
10560 10555 /* Other hooks are NULL by default. */
10561 terminal->rif = &x_redisplay_interface;
10562 10556
10563 return terminal; 10557 return terminal;
10564} 10558}