diff options
| author | Kenichi Handa | 2010-09-27 14:42:43 +0900 |
|---|---|---|
| committer | Kenichi Handa | 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 emacs-b3253cd4b4bcbe1ab4ad1fdc98b30c33af70332c.zip | |
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/>. */ | |||
| 31 | #include <unistd.h> | 31 | #include <unistd.h> |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | #ifdef HAVE_SYS_IOCTL_H | ||
| 35 | #include <sys/ioctl.h> | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #include <signal.h> | 34 | #include <signal.h> |
| 39 | #include <stdarg.h> | 35 | #include <stdarg.h> |
| 40 | #include <setjmp.h> | 36 | #include <setjmp.h> |
| @@ -2618,9 +2614,10 @@ term_clear_mouse_face (void) | |||
| 2618 | If POS is after end of W, return end of last line in W. | 2614 | If POS is after end of W, return end of last line in W. |
| 2619 | - taken from msdos.c */ | 2615 | - taken from msdos.c */ |
| 2620 | static int | 2616 | static int |
| 2621 | fast_find_position (struct window *w, int pos, int *hpos, int *vpos) | 2617 | fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos) |
| 2622 | { | 2618 | { |
| 2623 | int i, lastcol, line_start_position, maybe_next_line_p = 0; | 2619 | int i, lastcol, maybe_next_line_p = 0; |
| 2620 | EMACS_INT line_start_position; | ||
| 2624 | int yb = window_text_bottom_y (w); | 2621 | int yb = window_text_bottom_y (w); |
| 2625 | struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; | 2622 | struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; |
| 2626 | 2623 | ||
| @@ -2658,7 +2655,7 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos) | |||
| 2658 | for (i = 0; i < row->used[TEXT_AREA]; i++) | 2655 | for (i = 0; i < row->used[TEXT_AREA]; i++) |
| 2659 | { | 2656 | { |
| 2660 | struct glyph *glyph = row->glyphs[TEXT_AREA] + i; | 2657 | struct glyph *glyph = row->glyphs[TEXT_AREA] + i; |
| 2661 | int charpos; | 2658 | EMACS_INT charpos; |
| 2662 | 2659 | ||
| 2663 | charpos = glyph->charpos; | 2660 | charpos = glyph->charpos; |
| 2664 | if (charpos == pos) | 2661 | if (charpos == pos) |
| @@ -2719,7 +2716,8 @@ term_mouse_highlight (struct frame *f, int x, int y) | |||
| 2719 | && XFASTINT (w->last_modified) == BUF_MODIFF (b) | 2716 | && XFASTINT (w->last_modified) == BUF_MODIFF (b) |
| 2720 | && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) | 2717 | && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) |
| 2721 | { | 2718 | { |
| 2722 | int pos, i, nrows = w->current_matrix->nrows; | 2719 | int i, nrows = w->current_matrix->nrows; |
| 2720 | EMACS_INT pos; | ||
| 2723 | struct glyph_row *row; | 2721 | struct glyph_row *row; |
| 2724 | struct glyph *glyph; | 2722 | struct glyph *glyph; |
| 2725 | 2723 | ||
| @@ -2763,7 +2761,8 @@ term_mouse_highlight (struct frame *f, int x, int y) | |||
| 2763 | /* Check for mouse-face. */ | 2761 | /* Check for mouse-face. */ |
| 2764 | { | 2762 | { |
| 2765 | Lisp_Object mouse_face, overlay, position, *overlay_vec; | 2763 | Lisp_Object mouse_face, overlay, position, *overlay_vec; |
| 2766 | int noverlays, obegv, ozv; | 2764 | int noverlays; |
| 2765 | EMACS_INT obegv, ozv; | ||
| 2767 | struct buffer *obuf; | 2766 | struct buffer *obuf; |
| 2768 | 2767 | ||
| 2769 | /* If we get an out-of-range value, return now; avoid an error. */ | 2768 | /* 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) | |||
| 3404 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | 3403 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); |
| 3405 | Wcm_clear (tty); | 3404 | Wcm_clear (tty); |
| 3406 | 3405 | ||
| 3406 | encode_terminal_src_size = 0; | ||
| 3407 | encode_terminal_dst_size = 0; | ||
| 3408 | |||
| 3409 | #ifdef HAVE_GPM | ||
| 3410 | terminal->mouse_position_hook = term_mouse_position; | ||
| 3411 | mouse_face_window = Qnil; | ||
| 3412 | #endif | ||
| 3413 | |||
| 3414 | |||
| 3407 | #ifndef DOS_NT | 3415 | #ifndef DOS_NT |
| 3408 | set_tty_hooks (terminal); | 3416 | set_tty_hooks (terminal); |
| 3409 | 3417 | ||
| @@ -3457,78 +3465,6 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 3457 | 3465 | ||
| 3458 | add_keyboard_wait_descriptor (fileno (tty->input)); | 3466 | add_keyboard_wait_descriptor (fileno (tty->input)); |
| 3459 | 3467 | ||
| 3460 | #endif /* !DOS_NT */ | ||
| 3461 | |||
| 3462 | encode_terminal_src_size = 0; | ||
| 3463 | encode_terminal_dst_size = 0; | ||
| 3464 | |||
| 3465 | #ifdef HAVE_GPM | ||
| 3466 | terminal->mouse_position_hook = term_mouse_position; | ||
| 3467 | mouse_face_window = Qnil; | ||
| 3468 | #endif | ||
| 3469 | |||
| 3470 | #ifdef DOS_NT | ||
| 3471 | #ifdef WINDOWSNT | ||
| 3472 | initialize_w32_display (terminal); | ||
| 3473 | #else /* MSDOS */ | ||
| 3474 | if (strcmp (terminal_type, "internal") == 0) | ||
| 3475 | terminal->type = output_msdos_raw; | ||
| 3476 | initialize_msdos_display (terminal); | ||
| 3477 | #endif /* MSDOS */ | ||
| 3478 | tty->output = stdout; | ||
| 3479 | tty->input = stdin; | ||
| 3480 | /* The following two are inaccessible from w32console.c. */ | ||
| 3481 | terminal->delete_frame_hook = &tty_free_frame_resources; | ||
| 3482 | terminal->delete_terminal_hook = &delete_tty; | ||
| 3483 | |||
| 3484 | tty->name = xstrdup (name); | ||
| 3485 | terminal->name = xstrdup (name); | ||
| 3486 | tty->type = xstrdup (terminal_type); | ||
| 3487 | |||
| 3488 | add_keyboard_wait_descriptor (0); | ||
| 3489 | |||
| 3490 | Wcm_clear (tty); | ||
| 3491 | |||
| 3492 | #ifdef WINDOWSNT | ||
| 3493 | { | ||
| 3494 | struct frame *f = XFRAME (selected_frame); | ||
| 3495 | |||
| 3496 | FrameRows (tty) = FRAME_LINES (f); | ||
| 3497 | FrameCols (tty) = FRAME_COLS (f); | ||
| 3498 | tty->specified_window = FRAME_LINES (f); | ||
| 3499 | |||
| 3500 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; | ||
| 3501 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; | ||
| 3502 | } | ||
| 3503 | #else /* MSDOS */ | ||
| 3504 | { | ||
| 3505 | int height, width; | ||
| 3506 | get_tty_size (fileno (tty->input), &width, &height); | ||
| 3507 | FrameCols (tty) = width; | ||
| 3508 | FrameRows (tty) = height; | ||
| 3509 | } | ||
| 3510 | #endif /* MSDOS */ | ||
| 3511 | tty->delete_in_insert_mode = 1; | ||
| 3512 | |||
| 3513 | UseTabs (tty) = 0; | ||
| 3514 | terminal->scroll_region_ok = 0; | ||
| 3515 | |||
| 3516 | /* Seems to insert lines when it's not supposed to, messing up the | ||
| 3517 | display. In doing a trace, it didn't seem to be called much, so I | ||
| 3518 | don't think we're losing anything by turning it off. */ | ||
| 3519 | terminal->line_ins_del_ok = 0; | ||
| 3520 | #ifdef WINDOWSNT | ||
| 3521 | terminal->char_ins_del_ok = 1; | ||
| 3522 | baud_rate = 19200; | ||
| 3523 | #else /* MSDOS */ | ||
| 3524 | terminal->char_ins_del_ok = 0; | ||
| 3525 | init_baud_rate (fileno (tty->input)); | ||
| 3526 | #endif /* MSDOS */ | ||
| 3527 | |||
| 3528 | tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ | ||
| 3529 | |||
| 3530 | #else /* not DOS_NT */ | ||
| 3531 | |||
| 3532 | Wcm_clear (tty); | 3468 | Wcm_clear (tty); |
| 3533 | 3469 | ||
| 3534 | tty->termcap_term_buffer = (char *) xmalloc (buffer_size); | 3470 | tty->termcap_term_buffer = (char *) xmalloc (buffer_size); |
| @@ -3680,7 +3616,64 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ | |||
| 3680 | tty->TF_underscore = tgetflag ("ul"); | 3616 | tty->TF_underscore = tgetflag ("ul"); |
| 3681 | tty->TF_teleray = tgetflag ("xt"); | 3617 | tty->TF_teleray = tgetflag ("xt"); |
| 3682 | 3618 | ||
| 3683 | #endif /* !DOS_NT */ | 3619 | #else /* DOS_NT */ |
| 3620 | #ifdef WINDOWSNT | ||
| 3621 | { | ||
| 3622 | struct frame *f = XFRAME (selected_frame); | ||
| 3623 | |||
| 3624 | initialize_w32_display (terminal); | ||
| 3625 | |||
| 3626 | FrameRows (tty) = FRAME_LINES (f); | ||
| 3627 | FrameCols (tty) = FRAME_COLS (f); | ||
| 3628 | tty->specified_window = FRAME_LINES (f); | ||
| 3629 | |||
| 3630 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; | ||
| 3631 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; | ||
| 3632 | terminal->char_ins_del_ok = 1; | ||
| 3633 | baud_rate = 19200; | ||
| 3634 | } | ||
| 3635 | #else /* MSDOS */ | ||
| 3636 | { | ||
| 3637 | int height, width; | ||
| 3638 | if (strcmp (terminal_type, "internal") == 0) | ||
| 3639 | terminal->type = output_msdos_raw; | ||
| 3640 | initialize_msdos_display (terminal); | ||
| 3641 | |||
| 3642 | get_tty_size (fileno (tty->input), &width, &height); | ||
| 3643 | FrameCols (tty) = width; | ||
| 3644 | FrameRows (tty) = height; | ||
| 3645 | terminal->char_ins_del_ok = 0; | ||
| 3646 | init_baud_rate (fileno (tty->input)); | ||
| 3647 | } | ||
| 3648 | #endif /* MSDOS */ | ||
| 3649 | tty->output = stdout; | ||
| 3650 | tty->input = stdin; | ||
| 3651 | /* The following two are inaccessible from w32console.c. */ | ||
| 3652 | terminal->delete_frame_hook = &tty_free_frame_resources; | ||
| 3653 | terminal->delete_terminal_hook = &delete_tty; | ||
| 3654 | |||
| 3655 | tty->name = xstrdup (name); | ||
| 3656 | terminal->name = xstrdup (name); | ||
| 3657 | tty->type = xstrdup (terminal_type); | ||
| 3658 | |||
| 3659 | add_keyboard_wait_descriptor (0); | ||
| 3660 | |||
| 3661 | /* FIXME: this should be removed, done earlier. */ | ||
| 3662 | Wcm_clear (tty); | ||
| 3663 | |||
| 3664 | tty->delete_in_insert_mode = 1; | ||
| 3665 | |||
| 3666 | UseTabs (tty) = 0; | ||
| 3667 | terminal->scroll_region_ok = 0; | ||
| 3668 | |||
| 3669 | /* Seems to insert lines when it's not supposed to, messing up the | ||
| 3670 | display. In doing a trace, it didn't seem to be called much, so I | ||
| 3671 | don't think we're losing anything by turning it off. */ | ||
| 3672 | terminal->line_ins_del_ok = 0; | ||
| 3673 | |||
| 3674 | tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ | ||
| 3675 | #endif /* DOS_NT */ | ||
| 3676 | |||
| 3684 | terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); | 3677 | terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); |
| 3685 | init_kboard (terminal->kboard); | 3678 | init_kboard (terminal->kboard); |
| 3686 | terminal->kboard->Vwindow_system = Qnil; | 3679 | terminal->kboard->Vwindow_system = Qnil; |