diff options
author | Kenichi Handa <handa@m17n.org> | 2010-09-27 14:42:43 +0900 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2010-09-27 14:42:43 +0900 |
commit | b3253cd4b4bcbe1ab4ad1fdc98b30c33af70332c (patch) | |
tree | 4d55005558f96dfb44bfcd746098ed0882aff2d0 /src/term.c | |
parent | 4be9765d4bad14d68cdfee2a2c6afe1001d9516a (diff) | |
parent | e5fa38990bca723fc3ef1d0ede792e8ff84b84f7 (diff) | |
download | emacs-b3253cd4b4bcbe1ab4ad1fdc98b30c33af70332c.tar.gz |
merge trunk
Diffstat (limited to 'src/term.c')
-rw-r--r-- | src/term.c | 157 |
1 files changed, 75 insertions, 82 deletions
diff --git a/src/term.c b/src/term.c index 4c4ae5e048b..a2f7a9cbabe 100644 --- a/src/term.c +++ b/src/term.c @@ -31,10 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> #endif -#ifdef HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> -#endif - #include <signal.h> #include <stdarg.h> #include <setjmp.h> @@ -2618,9 +2614,10 @@ term_clear_mouse_face (void) If POS is after end of W, return end of last line in W. - taken from msdos.c */ static int -fast_find_position (struct window *w, int pos, int *hpos, int *vpos) +fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos) { - int i, lastcol, line_start_position, maybe_next_line_p = 0; + int i, lastcol, maybe_next_line_p = 0; + EMACS_INT line_start_position; int yb = window_text_bottom_y (w); struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; @@ -2658,7 +2655,7 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos) for (i = 0; i < row->used[TEXT_AREA]; i++) { struct glyph *glyph = row->glyphs[TEXT_AREA] + i; - int charpos; + EMACS_INT charpos; charpos = glyph->charpos; if (charpos == pos) @@ -2719,7 +2716,8 @@ term_mouse_highlight (struct frame *f, int x, int y) && XFASTINT (w->last_modified) == BUF_MODIFF (b) && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) { - int pos, i, nrows = w->current_matrix->nrows; + int i, nrows = w->current_matrix->nrows; + EMACS_INT pos; struct glyph_row *row; struct glyph *glyph; @@ -2763,7 +2761,8 @@ term_mouse_highlight (struct frame *f, int x, int y) /* Check for mouse-face. */ { Lisp_Object mouse_face, overlay, position, *overlay_vec; - int noverlays, obegv, ozv; + int noverlays; + EMACS_INT obegv, ozv; struct buffer *obuf; /* If we get an out-of-range value, return now; avoid an error. */ @@ -3404,6 +3403,15 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); Wcm_clear (tty); + encode_terminal_src_size = 0; + encode_terminal_dst_size = 0; + +#ifdef HAVE_GPM + terminal->mouse_position_hook = term_mouse_position; + mouse_face_window = Qnil; +#endif + + #ifndef DOS_NT set_tty_hooks (terminal); @@ -3457,78 +3465,6 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) add_keyboard_wait_descriptor (fileno (tty->input)); -#endif /* !DOS_NT */ - - encode_terminal_src_size = 0; - encode_terminal_dst_size = 0; - -#ifdef HAVE_GPM - terminal->mouse_position_hook = term_mouse_position; - mouse_face_window = Qnil; -#endif - -#ifdef DOS_NT -#ifdef WINDOWSNT - initialize_w32_display (terminal); -#else /* MSDOS */ - if (strcmp (terminal_type, "internal") == 0) - terminal->type = output_msdos_raw; - initialize_msdos_display (terminal); -#endif /* MSDOS */ - tty->output = stdout; - tty->input = stdin; - /* The following two are inaccessible from w32console.c. */ - terminal->delete_frame_hook = &tty_free_frame_resources; - terminal->delete_terminal_hook = &delete_tty; - - tty->name = xstrdup (name); - terminal->name = xstrdup (name); - tty->type = xstrdup (terminal_type); - - add_keyboard_wait_descriptor (0); - - Wcm_clear (tty); - -#ifdef WINDOWSNT - { - struct frame *f = XFRAME (selected_frame); - - FrameRows (tty) = FRAME_LINES (f); - FrameCols (tty) = FRAME_COLS (f); - tty->specified_window = FRAME_LINES (f); - - FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; - FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; - } -#else /* MSDOS */ - { - int height, width; - get_tty_size (fileno (tty->input), &width, &height); - FrameCols (tty) = width; - FrameRows (tty) = height; - } -#endif /* MSDOS */ - tty->delete_in_insert_mode = 1; - - UseTabs (tty) = 0; - terminal->scroll_region_ok = 0; - - /* Seems to insert lines when it's not supposed to, messing up the - display. In doing a trace, it didn't seem to be called much, so I - don't think we're losing anything by turning it off. */ - terminal->line_ins_del_ok = 0; -#ifdef WINDOWSNT - terminal->char_ins_del_ok = 1; - baud_rate = 19200; -#else /* MSDOS */ - terminal->char_ins_del_ok = 0; - init_baud_rate (fileno (tty->input)); -#endif /* MSDOS */ - - tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ - -#else /* not DOS_NT */ - Wcm_clear (tty); tty->termcap_term_buffer = (char *) xmalloc (buffer_size); @@ -3680,7 +3616,64 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ tty->TF_underscore = tgetflag ("ul"); tty->TF_teleray = tgetflag ("xt"); -#endif /* !DOS_NT */ +#else /* DOS_NT */ +#ifdef WINDOWSNT + { + struct frame *f = XFRAME (selected_frame); + + initialize_w32_display (terminal); + + FrameRows (tty) = FRAME_LINES (f); + FrameCols (tty) = FRAME_COLS (f); + tty->specified_window = FRAME_LINES (f); + + FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; + FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; + terminal->char_ins_del_ok = 1; + baud_rate = 19200; + } +#else /* MSDOS */ + { + int height, width; + if (strcmp (terminal_type, "internal") == 0) + terminal->type = output_msdos_raw; + initialize_msdos_display (terminal); + + get_tty_size (fileno (tty->input), &width, &height); + FrameCols (tty) = width; + FrameRows (tty) = height; + terminal->char_ins_del_ok = 0; + init_baud_rate (fileno (tty->input)); + } +#endif /* MSDOS */ + tty->output = stdout; + tty->input = stdin; + /* The following two are inaccessible from w32console.c. */ + terminal->delete_frame_hook = &tty_free_frame_resources; + terminal->delete_terminal_hook = &delete_tty; + + tty->name = xstrdup (name); + terminal->name = xstrdup (name); + tty->type = xstrdup (terminal_type); + + add_keyboard_wait_descriptor (0); + + /* FIXME: this should be removed, done earlier. */ + Wcm_clear (tty); + + tty->delete_in_insert_mode = 1; + + UseTabs (tty) = 0; + terminal->scroll_region_ok = 0; + + /* Seems to insert lines when it's not supposed to, messing up the + display. In doing a trace, it didn't seem to be called much, so I + don't think we're losing anything by turning it off. */ + terminal->line_ins_del_ok = 0; + + tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ +#endif /* DOS_NT */ + terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); terminal->kboard->Vwindow_system = Qnil; |