diff options
| author | Karoly Lorentey | 2004-01-02 02:54:17 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-01-02 02:54:17 +0000 |
| commit | 7b00d185eba8e01f191a69740e3270c88f88159c (patch) | |
| tree | 1bddf818e98404035261883f3cbfc5e4c80f40bf /src/term.c | |
| parent | daf0170133e658c41f3ae2fc8558c5ab74227c1d (diff) | |
| download | emacs-7b00d185eba8e01f191a69740e3270c88f88159c.tar.gz emacs-7b00d185eba8e01f191a69740e3270c88f88159c.zip | |
MULTI_KBOARD support for ttys. Input-related bugfixes for X+tty sessions.
lib-src/emacsclient.c (pty_conversation): Fix errno check for read from fileno(in).
src/config.in: Unconditionally define MULTI_KBOARD.
src/frame.c (make_terminal_frame): Initialize f->kboard.
src/keyboard.c (cmd_error_internal): Don't kill Emacs if a Quit was
pressed on the tty of a X+tty session.
(read_avail_input): Initialize nread to zero. Abort if there is no
tty after a termcap read.
(interrupt_signal)[USG]: Always reset signal handler.
(init_keyboard): Always set signal handler for SIGINT/SIGQUIT if
noninteractive.
src/term.c (term_dummy_init): Initialize kboard to the initial_kboard.
(term_init): Free component structures of the initial tty. Clear xmalloced structures.
Moved rif initialization to syms_of_term.
(term_init)[MULTI_KBOARD]: Initialize tty->kboard.
(delete_tty)[MULTI_KBOARD]: Delete the keyboard.
(syms_of_term): Initialize tty_display_method_template.
src/termchar.h (tty_output)[MULTI_KBOARD]: Added kboard member.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-31
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/src/term.c b/src/term.c index c8310b5b85b..b35a20a2ff0 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2189,6 +2189,7 @@ term_dummy_init (void) | |||
| 2189 | tty_list->output = stdout; | 2189 | tty_list->output = stdout; |
| 2190 | tty_list->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | 2190 | tty_list->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); |
| 2191 | tty_list->display_method = (struct display_method *) xmalloc (sizeof (struct display_method)); | 2191 | tty_list->display_method = (struct display_method *) xmalloc (sizeof (struct display_method)); |
| 2192 | tty_list->kboard = initial_kboard; | ||
| 2192 | return tty_list; | 2193 | return tty_list; |
| 2193 | } | 2194 | } |
| 2194 | 2195 | ||
| @@ -2212,6 +2213,15 @@ term_init (Lisp_Object frame, char *name, char *terminal_type) | |||
| 2212 | the dummy terminal created for the initial frame. */ | 2213 | the dummy terminal created for the initial frame. */ |
| 2213 | if (tty->type) | 2214 | if (tty->type) |
| 2214 | return tty; | 2215 | return tty; |
| 2216 | |||
| 2217 | /* Free up temporary structures. */ | ||
| 2218 | if (tty->Wcm) | ||
| 2219 | xfree (tty->Wcm); | ||
| 2220 | if (tty->display_method) | ||
| 2221 | xfree (tty->display_method); | ||
| 2222 | if (tty->kboard != initial_kboard) | ||
| 2223 | abort (); | ||
| 2224 | tty->kboard = 0; | ||
| 2215 | } | 2225 | } |
| 2216 | else | 2226 | else |
| 2217 | { | 2227 | { |
| @@ -2221,20 +2231,18 @@ term_init (Lisp_Object frame, char *name, char *terminal_type) | |||
| 2221 | tty_list = tty; | 2231 | tty_list = tty; |
| 2222 | } | 2232 | } |
| 2223 | 2233 | ||
| 2224 | if (! tty->Wcm) | 2234 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); |
| 2225 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | 2235 | Wcm_clear (tty); |
| 2226 | 2236 | ||
| 2227 | if (! tty->display_method) | 2237 | /* Each termcap frame has its own display method. */ |
| 2228 | tty->display_method = (struct display_method *) xmalloc (sizeof (struct display_method)); | 2238 | tty->display_method = (struct display_method *) xmalloc (sizeof (struct display_method)); |
| 2239 | bzero (tty->display_method, sizeof (struct display_method)); | ||
| 2229 | 2240 | ||
| 2230 | /* Initialize the common members in the new display method with our | 2241 | /* Initialize the common members in the new display method with our |
| 2231 | predefined template. */ | 2242 | predefined template. */ |
| 2232 | *tty->display_method = tty_display_method_template; | 2243 | *tty->display_method = tty_display_method_template; |
| 2233 | f->display_method = tty->display_method; | 2244 | f->display_method = tty->display_method; |
| 2234 | 2245 | ||
| 2235 | /* Termcap-based displays don't support window-based redisplay. */ | ||
| 2236 | f->display_method->rif = 0; | ||
| 2237 | |||
| 2238 | /* Make sure the frame is live; if an error happens, it must be | 2246 | /* Make sure the frame is live; if an error happens, it must be |
| 2239 | deleted. */ | 2247 | deleted. */ |
| 2240 | f->output_method = output_termcap; | 2248 | f->output_method = output_termcap; |
| @@ -2278,7 +2286,7 @@ term_init (Lisp_Object frame, char *name, char *terminal_type) | |||
| 2278 | FrameCols (tty) = FRAME_COLS (f); | 2286 | FrameCols (tty) = FRAME_COLS (f); |
| 2279 | tty->specified_window = FRAME_LINES (f); | 2287 | tty->specified_window = FRAME_LINES (f); |
| 2280 | 2288 | ||
| 2281 | f->display_method->delete_in_insert_mode = 1; | 2289 | tty->display_method->delete_in_insert_mode = 1; |
| 2282 | 2290 | ||
| 2283 | UseTabs (tty) = 0; | 2291 | UseTabs (tty) = 0; |
| 2284 | FRAME_SCROLL_REGION_OK (f) = 0; | 2292 | FRAME_SCROLL_REGION_OK (f) = 0; |
| @@ -2509,7 +2517,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2509 | } | 2517 | } |
| 2510 | 2518 | ||
| 2511 | #if 0 /* This is not used anywhere. */ | 2519 | #if 0 /* This is not used anywhere. */ |
| 2512 | f->display_method->min_padding_speed = tgetnum ("pb"); | 2520 | tty->display_method->min_padding_speed = tgetnum ("pb"); |
| 2513 | #endif | 2521 | #endif |
| 2514 | 2522 | ||
| 2515 | TabWidth (tty) = tgetnum ("tw"); | 2523 | TabWidth (tty) = tgetnum ("tw"); |
| @@ -2723,6 +2731,19 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2723 | FRAME_CHAR_INS_DEL_OK (f) = 0; | 2731 | FRAME_CHAR_INS_DEL_OK (f) = 0; |
| 2724 | #endif | 2732 | #endif |
| 2725 | 2733 | ||
| 2734 | #ifdef MULTI_KBOARD | ||
| 2735 | tty->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); | ||
| 2736 | init_kboard (tty->kboard); | ||
| 2737 | tty->kboard->next_kboard = all_kboards; | ||
| 2738 | all_kboards = tty->kboard; | ||
| 2739 | /* Don't let the initial kboard remain current longer than necessary. | ||
| 2740 | That would cause problems if a file loaded on startup tries to | ||
| 2741 | prompt in the mini-buffer. */ | ||
| 2742 | if (current_kboard == initial_kboard) | ||
| 2743 | current_kboard = tty->kboard; | ||
| 2744 | tty->kboard->reference_count++; | ||
| 2745 | #endif | ||
| 2746 | |||
| 2726 | /* Don't do this. I think termcap may still need the buffer. */ | 2747 | /* Don't do this. I think termcap may still need the buffer. */ |
| 2727 | /* xfree (buffer); */ | 2748 | /* xfree (buffer); */ |
| 2728 | 2749 | ||
| @@ -2735,7 +2756,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2735 | tty_set_terminal_modes (tty); | 2756 | tty_set_terminal_modes (tty); |
| 2736 | 2757 | ||
| 2737 | return tty; | 2758 | return tty; |
| 2738 | #endif /* WINDOWSNT */ | 2759 | #endif /* not WINDOWSNT */ |
| 2739 | } | 2760 | } |
| 2740 | 2761 | ||
| 2741 | /* VARARGS 1 */ | 2762 | /* VARARGS 1 */ |
| @@ -2844,6 +2865,13 @@ delete_tty (struct tty_display_info *tty) | |||
| 2844 | if (tty->display_method) | 2865 | if (tty->display_method) |
| 2845 | xfree (tty->display_method); | 2866 | xfree (tty->display_method); |
| 2846 | 2867 | ||
| 2868 | #ifdef MULTI_KBOARD | ||
| 2869 | if (tty->kboard && --tty->kboard->reference_count > 0) | ||
| 2870 | abort (); | ||
| 2871 | if (tty->kboard) | ||
| 2872 | delete_kboard (tty->kboard); | ||
| 2873 | #endif | ||
| 2874 | |||
| 2847 | bzero (tty, sizeof (struct tty_display_info)); | 2875 | bzero (tty, sizeof (struct tty_display_info)); |
| 2848 | xfree (tty); | 2876 | xfree (tty); |
| 2849 | deleting_tty = 0; | 2877 | deleting_tty = 0; |
| @@ -2897,9 +2925,13 @@ The function should accept no arguments. */); | |||
| 2897 | defsubr (&Sframe_tty_type); | 2925 | defsubr (&Sframe_tty_type); |
| 2898 | defsubr (&Sdelete_tty); | 2926 | defsubr (&Sdelete_tty); |
| 2899 | 2927 | ||
| 2900 | /* XXX tty_display_method_template initialization will go here. */ | ||
| 2901 | |||
| 2902 | Fprovide (intern ("multi-tty"), Qnil); | 2928 | Fprovide (intern ("multi-tty"), Qnil); |
| 2929 | |||
| 2930 | /* Initialize the display method template. */ | ||
| 2931 | |||
| 2932 | /* Termcap-based displays don't support window-based redisplay. */ | ||
| 2933 | tty_display_method_template.rif = 0; | ||
| 2934 | |||
| 2903 | } | 2935 | } |
| 2904 | 2936 | ||
| 2905 | 2937 | ||