diff options
Diffstat (limited to 'src/term.c')
-rw-r--r-- | src/term.c | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/src/term.c b/src/term.c index dcb7d75aa54..c5a1fb99a15 100644 --- a/src/term.c +++ b/src/term.c @@ -1359,8 +1359,7 @@ term_get_fkeys_1 (void) char *sequence = tgetstr (keys[i].cap, address); if (sequence) Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), - Fmake_vector (make_number (1), - intern (keys[i].name))); + make_vector (1, intern (keys[i].name))); } /* The uses of the "k0" capability are inconsistent; sometimes it @@ -1379,13 +1378,13 @@ term_get_fkeys_1 (void) /* Define f0 first, so that f10 takes precedence in case the key sequences happens to be the same. */ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0), - Fmake_vector (make_number (1), intern ("f0"))); + make_vector (1, intern ("f0"))); Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi), - Fmake_vector (make_number (1), intern ("f10"))); + make_vector (1, intern ("f10"))); } else if (k0) Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0), - Fmake_vector (make_number (1), intern (k0_name))); + make_vector (1, intern (k0_name))); } /* Set up cookies for numbered function keys above f10. */ @@ -1408,8 +1407,7 @@ term_get_fkeys_1 (void) { sprintf (fkey, "f%d", i); Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), - Fmake_vector (make_number (1), - intern (fkey))); + make_vector (1, intern (fkey))); } } } @@ -1425,8 +1423,7 @@ term_get_fkeys_1 (void) char *sequence = tgetstr (cap2, address); \ if (sequence) \ Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence), \ - Fmake_vector (make_number (1), \ - intern (sym))); \ + make_vector (1, intern (sym))); \ } /* if there's no key_next keycap, map key_npage to `next' keysym */ @@ -2050,7 +2047,7 @@ TERMINAL does not refer to a text terminal. */) { struct terminal *t = decode_tty_terminal (terminal); - return make_number (t ? t->display_info.tty->TN_max_colors : 0); + return make_fixnum (t ? t->display_info.tty->TN_max_colors : 0); } #ifndef DOS_NT @@ -2137,7 +2134,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) tem = assq_no_quit (Qtty_color_mode, f->param_alist); val = CONSP (tem) ? XCDR (tem) : Qnil; - if (INTEGERP (val)) + if (FIXNUMP (val)) color_mode = val; else if (SYMBOLP (tty_color_mode_alist)) { @@ -2147,7 +2144,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) else color_mode = Qnil; - mode = TYPE_RANGED_INTEGERP (int, color_mode) ? XINT (color_mode) : 0; + mode = TYPE_RANGED_FIXNUMP (int, color_mode) ? XFIXNUM (color_mode) : 0; if (mode != tty->previous_color_mode) { @@ -2721,7 +2718,7 @@ typedef struct tty_menu_struct /* Create a brand new menu structure. */ -static tty_menu * +static tty_menu * ATTRIBUTE_MALLOC tty_menu_create (void) { return xzalloc (sizeof *tty_menu_create ()); @@ -2805,8 +2802,8 @@ mouse_get_xy (int *x, int *y) &time_dummy); if (!NILP (lmx)) { - *x = XINT (lmx); - *y = XINT (lmy); + *x = XFIXNUM (lmx); + *y = XFIXNUM (lmy); } } @@ -3132,15 +3129,15 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, SAFE_NALLOCA (state, 1, menu->panecount); memset (state, 0, sizeof (*state)); faces[0] - = lookup_derived_face (sf, intern ("tty-menu-disabled-face"), + = lookup_derived_face (NULL, sf, intern ("tty-menu-disabled-face"), DEFAULT_FACE_ID, 1); faces[1] - = lookup_derived_face (sf, intern ("tty-menu-enabled-face"), + = lookup_derived_face (NULL, sf, intern ("tty-menu-enabled-face"), DEFAULT_FACE_ID, 1); selectface = intern ("tty-menu-selected-face"); - faces[2] = lookup_derived_face (sf, selectface, + faces[2] = lookup_derived_face (NULL, sf, selectface, faces[0], 1); - faces[3] = lookup_derived_face (sf, selectface, + faces[3] = lookup_derived_face (NULL, sf, selectface, faces[1], 1); /* Make sure the menu title is always displayed with @@ -3403,20 +3400,25 @@ tty_menu_help_callback (char const *help_string, int pane, int item) pane_name = first_item[MENU_ITEMS_ITEM_NAME]; /* (menu-item MENU-NAME PANE-NUMBER) */ - menu_object = list3 (Qmenu_item, pane_name, make_number (pane)); + menu_object = list3 (Qmenu_item, pane_name, make_fixnum (pane)); show_help_echo (help_string ? build_string (help_string) : Qnil, - Qnil, menu_object, make_number (item)); + Qnil, menu_object, make_fixnum (item)); } +struct tty_pop_down_menu +{ + tty_menu *menu; + struct buffer *buffer; +}; + static void -tty_pop_down_menu (Lisp_Object arg) +tty_pop_down_menu (void *arg) { - tty_menu *menu = XSAVE_POINTER (arg, 0); - struct buffer *orig_buffer = XSAVE_POINTER (arg, 1); + struct tty_pop_down_menu *data = arg; block_input (); - tty_menu_destroy (menu); - set_buffer_internal (orig_buffer); + tty_menu_destroy (data->menu); + set_buffer_internal (data->buffer); unblock_input (); } @@ -3472,7 +3474,7 @@ tty_menu_new_item_coords (struct frame *f, int which, int *x, int *y) pos = AREF (items, i + 3); if (NILP (str)) return; - ix = XINT (pos); + ix = XFIXNUM (pos); if (ix <= *x /* We use <= so the blank between 2 items on a TTY is considered part of the previous item. */ @@ -3483,14 +3485,14 @@ tty_menu_new_item_coords (struct frame *f, int which, int *x, int *y) if (which == TTYM_NEXT) { if (i < last_i) - *x = XINT (AREF (items, i + 4 + 3)); + *x = XFIXNUM (AREF (items, i + 4 + 3)); else *x = 0; /* Wrap around to the first item. */ } else if (prev_x < 0) { /* Wrap around to the last item. */ - *x = XINT (AREF (items, last_i + 3)); + *x = XFIXNUM (AREF (items, last_i + 3)); } else *x = prev_x; @@ -3697,8 +3699,9 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags, /* We save and restore the current buffer because tty_menu_activate triggers redisplay, which switches buffers at will. */ - record_unwind_protect (tty_pop_down_menu, - make_save_ptr_ptr (menu, current_buffer)); + record_unwind_protect_ptr (tty_pop_down_menu, + &((struct tty_pop_down_menu) + {menu, current_buffer})); specbind (Qoverriding_terminal_local_map, Fsymbol_value (Qtty_menu_navigation_map)); @@ -3748,7 +3751,7 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags, case TTYM_NEXT: case TTYM_PREV: tty_menu_new_item_coords (f, status, &item_x, &item_y); - entry = Fcons (make_number (item_x), make_number (item_y)); + entry = Fcons (make_fixnum (item_x), make_fixnum (item_y)); break; case TTYM_FAILURE: @@ -3770,9 +3773,7 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags, tty_menu_end: - SAFE_FREE (); - unbind_to (specpdl_count, Qnil); - return entry; + return SAFE_FREE_UNBIND_TO (specpdl_count, entry); } #endif /* !MSDOS */ @@ -4145,10 +4146,10 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ tty->TN_max_colors = tgetnum ("Co"); #ifdef TERMINFO - /* Non-standard support for 24-bit colors. */ { const char *fg = tigetstr ("setf24"); const char *bg = tigetstr ("setb24"); + /* Non-standard support for 24-bit colors. */ if (fg && bg && fg != (char *) (intptr_t) -1 && bg != (char *) (intptr_t) -1) @@ -4157,6 +4158,14 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ tty->TS_set_background = bg; tty->TN_max_colors = 16777216; } + /* Standard support for 24-bit colors. */ + else if (tigetflag ("RGB") > 0) + { + /* If the used Terminfo library supports only 16-bit + signed values, tgetnum("Co") and tigetnum("colors") + could return 32767. */ + tty->TN_max_colors = 16777216; + } } #endif |