diff options
| author | Tom Tromey | 2013-07-12 18:44:13 -0600 |
|---|---|---|
| committer | Tom Tromey | 2013-07-12 18:44:13 -0600 |
| commit | b34a529f177a6ea32da5cb1254f91bf9d71838db (patch) | |
| tree | 477131abc15d3107b30b635223d87a22550b480b /src/term.c | |
| parent | e6f63071a3f7721f55220514b6d9a8ee8c1232d8 (diff) | |
| parent | 5e301d7651c0691bb2bc7f3fbe711fdbe26ac471 (diff) | |
| download | emacs-b34a529f177a6ea32da5cb1254f91bf9d71838db.tar.gz emacs-b34a529f177a6ea32da5cb1254f91bf9d71838db.zip | |
Merge from trunk
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/src/term.c b/src/term.c index 39d143564c6..b6878a0abd1 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -71,13 +71,13 @@ static void tty_turn_off_highlight (struct tty_display_info *); | |||
| 71 | static void tty_show_cursor (struct tty_display_info *); | 71 | static void tty_show_cursor (struct tty_display_info *); |
| 72 | static void tty_hide_cursor (struct tty_display_info *); | 72 | static void tty_hide_cursor (struct tty_display_info *); |
| 73 | static void tty_background_highlight (struct tty_display_info *tty); | 73 | static void tty_background_highlight (struct tty_display_info *tty); |
| 74 | static struct terminal *get_tty_terminal (Lisp_Object, int); | 74 | static struct terminal *get_tty_terminal (Lisp_Object, bool); |
| 75 | static void clear_tty_hooks (struct terminal *terminal); | 75 | static void clear_tty_hooks (struct terminal *terminal); |
| 76 | static void set_tty_hooks (struct terminal *terminal); | 76 | static void set_tty_hooks (struct terminal *terminal); |
| 77 | static void dissociate_if_controlling_tty (int fd); | 77 | static void dissociate_if_controlling_tty (int fd); |
| 78 | static void delete_tty (struct terminal *); | 78 | static void delete_tty (struct terminal *); |
| 79 | static _Noreturn void maybe_fatal (int must_succeed, struct terminal *terminal, | 79 | static _Noreturn void maybe_fatal (bool, struct terminal *, |
| 80 | const char *str1, const char *str2, ...) | 80 | const char *, const char *, ...) |
| 81 | ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5); | 81 | ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5); |
| 82 | static _Noreturn void vfatal (const char *str, va_list ap) | 82 | static _Noreturn void vfatal (const char *str, va_list ap) |
| 83 | ATTRIBUTE_FORMAT_PRINTF (1, 0); | 83 | ATTRIBUTE_FORMAT_PRINTF (1, 0); |
| @@ -85,8 +85,7 @@ static _Noreturn void vfatal (const char *str, va_list ap) | |||
| 85 | 85 | ||
| 86 | #define OUTPUT(tty, a) \ | 86 | #define OUTPUT(tty, a) \ |
| 87 | emacs_tputs ((tty), a, \ | 87 | emacs_tputs ((tty), a, \ |
| 88 | (int) (FRAME_LINES (XFRAME (selected_frame)) \ | 88 | FRAME_LINES (XFRAME (selected_frame)) - curY (tty), \ |
| 89 | - curY (tty)), \ | ||
| 90 | cmputc) | 89 | cmputc) |
| 91 | 90 | ||
| 92 | #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) | 91 | #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) |
| @@ -695,7 +694,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 695 | { | 694 | { |
| 696 | unsigned char *conversion_buffer; | 695 | unsigned char *conversion_buffer; |
| 697 | struct coding_system *coding; | 696 | struct coding_system *coding; |
| 698 | size_t n, stringlen; | 697 | int n, stringlen; |
| 699 | 698 | ||
| 700 | struct tty_display_info *tty = FRAME_TTY (f); | 699 | struct tty_display_info *tty = FRAME_TTY (f); |
| 701 | 700 | ||
| @@ -1431,7 +1430,7 @@ static void append_glyph (struct it *); | |||
| 1431 | static void append_composite_glyph (struct it *); | 1430 | static void append_composite_glyph (struct it *); |
| 1432 | static void produce_composite_glyph (struct it *); | 1431 | static void produce_composite_glyph (struct it *); |
| 1433 | static void append_glyphless_glyph (struct it *, int, const char *); | 1432 | static void append_glyphless_glyph (struct it *, int, const char *); |
| 1434 | static void produce_glyphless_glyph (struct it *, int, Lisp_Object); | 1433 | static void produce_glyphless_glyph (struct it *, Lisp_Object); |
| 1435 | 1434 | ||
| 1436 | /* Append glyphs to IT's glyph_row. Called from produce_glyphs for | 1435 | /* Append glyphs to IT's glyph_row. Called from produce_glyphs for |
| 1437 | terminal frames if IT->glyph_row != NULL. IT->char_to_display is | 1436 | terminal frames if IT->glyph_row != NULL. IT->char_to_display is |
| @@ -1551,7 +1550,7 @@ produce_glyphs (struct it *it) | |||
| 1551 | 1550 | ||
| 1552 | if (it->what == IT_GLYPHLESS) | 1551 | if (it->what == IT_GLYPHLESS) |
| 1553 | { | 1552 | { |
| 1554 | produce_glyphless_glyph (it, 0, Qnil); | 1553 | produce_glyphless_glyph (it, Qnil); |
| 1555 | goto done; | 1554 | goto done; |
| 1556 | } | 1555 | } |
| 1557 | 1556 | ||
| @@ -1620,7 +1619,7 @@ produce_glyphs (struct it *it) | |||
| 1620 | Lisp_Object acronym = lookup_glyphless_char_display (-1, it); | 1619 | Lisp_Object acronym = lookup_glyphless_char_display (-1, it); |
| 1621 | 1620 | ||
| 1622 | eassert (it->what == IT_GLYPHLESS); | 1621 | eassert (it->what == IT_GLYPHLESS); |
| 1623 | produce_glyphless_glyph (it, 1, acronym); | 1622 | produce_glyphless_glyph (it, acronym); |
| 1624 | } | 1623 | } |
| 1625 | } | 1624 | } |
| 1626 | 1625 | ||
| @@ -1794,14 +1793,12 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str) | |||
| 1794 | the character. See the description of enum | 1793 | the character. See the description of enum |
| 1795 | glyphless_display_method in dispextern.h for the details. | 1794 | glyphless_display_method in dispextern.h for the details. |
| 1796 | 1795 | ||
| 1797 | FOR_NO_FONT is nonzero if and only if this is for a character that | 1796 | ACRONYM, if non-nil, is an acronym string for the character. |
| 1798 | is not supported by the coding system of the terminal. ACRONYM, if | ||
| 1799 | non-nil, is an acronym string for the character. | ||
| 1800 | 1797 | ||
| 1801 | The glyphs actually produced are of type CHAR_GLYPH. */ | 1798 | The glyphs actually produced are of type CHAR_GLYPH. */ |
| 1802 | 1799 | ||
| 1803 | static void | 1800 | static void |
| 1804 | produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | 1801 | produce_glyphless_glyph (struct it *it, Lisp_Object acronym) |
| 1805 | { | 1802 | { |
| 1806 | int face_id; | 1803 | int face_id; |
| 1807 | int len; | 1804 | int len; |
| @@ -1968,7 +1965,7 @@ turn_on_face (struct frame *f, int face_id) | |||
| 1968 | ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; | 1965 | ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; |
| 1969 | if (fg >= 0 && ts) | 1966 | if (fg >= 0 && ts) |
| 1970 | { | 1967 | { |
| 1971 | p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0); | 1968 | p = tparam (ts, NULL, 0, fg, 0, 0, 0); |
| 1972 | OUTPUT (tty, p); | 1969 | OUTPUT (tty, p); |
| 1973 | xfree (p); | 1970 | xfree (p); |
| 1974 | } | 1971 | } |
| @@ -1976,7 +1973,7 @@ turn_on_face (struct frame *f, int face_id) | |||
| 1976 | ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; | 1973 | ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; |
| 1977 | if (bg >= 0 && ts) | 1974 | if (bg >= 0 && ts) |
| 1978 | { | 1975 | { |
| 1979 | p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0); | 1976 | p = tparam (ts, NULL, 0, bg, 0, 0, 0); |
| 1980 | OUTPUT (tty, p); | 1977 | OUTPUT (tty, p); |
| 1981 | xfree (p); | 1978 | xfree (p); |
| 1982 | } | 1979 | } |
| @@ -2027,11 +2024,11 @@ turn_off_face (struct frame *f, int face_id) | |||
| 2027 | } | 2024 | } |
| 2028 | 2025 | ||
| 2029 | 2026 | ||
| 2030 | /* Return non-zero if the terminal on frame F supports all of the | 2027 | /* Return true if the terminal on frame F supports all of the |
| 2031 | capabilities in CAPS simultaneously, with foreground and background | 2028 | capabilities in CAPS simultaneously, with foreground and background |
| 2032 | colors FG and BG. */ | 2029 | colors FG and BG. */ |
| 2033 | 2030 | ||
| 2034 | int | 2031 | bool |
| 2035 | tty_capable_p (struct tty_display_info *tty, unsigned int caps, | 2032 | tty_capable_p (struct tty_display_info *tty, unsigned int caps, |
| 2036 | unsigned long fg, unsigned long bg) | 2033 | unsigned long fg, unsigned long bg) |
| 2037 | { | 2034 | { |
| @@ -2099,7 +2096,7 @@ static char *default_set_background; | |||
| 2099 | /* Save or restore the default color-related capabilities of this | 2096 | /* Save or restore the default color-related capabilities of this |
| 2100 | terminal. */ | 2097 | terminal. */ |
| 2101 | static void | 2098 | static void |
| 2102 | tty_default_color_capabilities (struct tty_display_info *tty, int save) | 2099 | tty_default_color_capabilities (struct tty_display_info *tty, bool save) |
| 2103 | { | 2100 | { |
| 2104 | 2101 | ||
| 2105 | if (save) | 2102 | if (save) |
| @@ -2209,7 +2206,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) | |||
| 2209 | /* Return the tty display object specified by TERMINAL. */ | 2206 | /* Return the tty display object specified by TERMINAL. */ |
| 2210 | 2207 | ||
| 2211 | static struct terminal * | 2208 | static struct terminal * |
| 2212 | get_tty_terminal (Lisp_Object terminal, int throw) | 2209 | get_tty_terminal (Lisp_Object terminal, bool throw) |
| 2213 | { | 2210 | { |
| 2214 | struct terminal *t = get_terminal (terminal, throw); | 2211 | struct terminal *t = get_terminal (terminal, throw); |
| 2215 | 2212 | ||
| @@ -2481,7 +2478,7 @@ term_mouse_moveto (int x, int y) | |||
| 2481 | name = (const char *) ttyname (0); | 2478 | name = (const char *) ttyname (0); |
| 2482 | fd = emacs_open (name, O_WRONLY, 0); | 2479 | fd = emacs_open (name, O_WRONLY, 0); |
| 2483 | SOME_FUNCTION (x, y, fd); | 2480 | SOME_FUNCTION (x, y, fd); |
| 2484 | close (fd); | 2481 | emacs_close (fd); |
| 2485 | last_mouse_x = x; | 2482 | last_mouse_x = x; |
| 2486 | last_mouse_y = y; */ | 2483 | last_mouse_y = y; */ |
| 2487 | } | 2484 | } |
| @@ -2519,7 +2516,7 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row, | |||
| 2519 | cursor_to (f, save_y, save_x); | 2516 | cursor_to (f, save_y, save_x); |
| 2520 | } | 2517 | } |
| 2521 | 2518 | ||
| 2522 | static int | 2519 | static bool |
| 2523 | term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) | 2520 | term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) |
| 2524 | { | 2521 | { |
| 2525 | /* Has the mouse moved off the glyph it was on at the last sighting? */ | 2522 | /* Has the mouse moved off the glyph it was on at the last sighting? */ |
| @@ -2649,7 +2646,7 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event, struct in | |||
| 2649 | { | 2646 | { |
| 2650 | struct frame *f = XFRAME (tty->top_frame); | 2647 | struct frame *f = XFRAME (tty->top_frame); |
| 2651 | struct input_event ie; | 2648 | struct input_event ie; |
| 2652 | int do_help = 0; | 2649 | bool do_help = 0; |
| 2653 | int count = 0; | 2650 | int count = 0; |
| 2654 | 2651 | ||
| 2655 | EVENT_INIT (ie); | 2652 | EVENT_INIT (ie); |
| @@ -2934,7 +2931,7 @@ dissociate_if_controlling_tty (int fd) | |||
| 2934 | If MUST_SUCCEED is true, then all errors are fatal. */ | 2931 | If MUST_SUCCEED is true, then all errors are fatal. */ |
| 2935 | 2932 | ||
| 2936 | struct terminal * | 2933 | struct terminal * |
| 2937 | init_tty (const char *name, const char *terminal_type, int must_succeed) | 2934 | init_tty (const char *name, const char *terminal_type, bool must_succeed) |
| 2938 | { | 2935 | { |
| 2939 | char *area = NULL; | 2936 | char *area = NULL; |
| 2940 | char **address = &area; | 2937 | char **address = &area; |
| @@ -2942,7 +2939,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 2942 | int status; | 2939 | int status; |
| 2943 | struct tty_display_info *tty = NULL; | 2940 | struct tty_display_info *tty = NULL; |
| 2944 | struct terminal *terminal = NULL; | 2941 | struct terminal *terminal = NULL; |
| 2945 | int ctty = 0; /* 1 if asked to open controlling tty. */ | 2942 | bool ctty = 0; /* True if asked to open controlling tty. */ |
| 2946 | 2943 | ||
| 2947 | if (!terminal_type) | 2944 | if (!terminal_type) |
| 2948 | maybe_fatal (must_succeed, 0, | 2945 | maybe_fatal (must_succeed, 0, |
| @@ -3015,7 +3012,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 3015 | name); | 3012 | name); |
| 3016 | if (!isatty (fd)) | 3013 | if (!isatty (fd)) |
| 3017 | { | 3014 | { |
| 3018 | close (fd); | 3015 | emacs_close (fd); |
| 3019 | maybe_fatal (must_succeed, terminal, | 3016 | maybe_fatal (must_succeed, terminal, |
| 3020 | "Not a tty device: %s", | 3017 | "Not a tty device: %s", |
| 3021 | "Not a tty device: %s", | 3018 | "Not a tty device: %s", |
| @@ -3412,10 +3409,10 @@ vfatal (const char *str, va_list ap) | |||
| 3412 | 3409 | ||
| 3413 | /* Auxiliary error-handling function for init_tty. | 3410 | /* Auxiliary error-handling function for init_tty. |
| 3414 | Delete TERMINAL, then call error or fatal with str1 or str2, | 3411 | Delete TERMINAL, then call error or fatal with str1 or str2, |
| 3415 | respectively, according to whether MUST_SUCCEED is zero or not. */ | 3412 | respectively, according to whether MUST_SUCCEED is true. */ |
| 3416 | 3413 | ||
| 3417 | static void | 3414 | static void |
| 3418 | maybe_fatal (int must_succeed, struct terminal *terminal, | 3415 | maybe_fatal (bool must_succeed, struct terminal *terminal, |
| 3419 | const char *str1, const char *str2, ...) | 3416 | const char *str1, const char *str2, ...) |
| 3420 | { | 3417 | { |
| 3421 | va_list ap; | 3418 | va_list ap; |