X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fredisplay-tty.c;h=42d18b925f2da4ef7e2c4d70ada536be07768e1b;hb=a1655b870904de973c366d85ebdc8adde4ef5e1e;hp=9e8515dc443dd368aa3052a83725a04f924296d3;hpb=2e3e3f9ee27fec50f45c282d71eaddf7c673bc56;p=chise%2Fxemacs-chise.git diff --git a/src/redisplay-tty.c b/src/redisplay-tty.c index 9e8515d..42d18b9 100644 --- a/src/redisplay-tty.c +++ b/src/redisplay-tty.c @@ -56,11 +56,11 @@ Boston, MA 02111-1307, USA. */ #ifdef __cplusplus extern "C" { #endif -extern int tgetent (CONST char *, CONST char *); -extern int tgetflag (CONST char *); -extern int tgetnum (CONST char *); -extern char *tgetstr (CONST char *, char **); -extern void tputs (CONST char *, int, void (*)(int)); +extern int tgetent (const char *, const char *); +extern int tgetflag (const char *); +extern int tgetnum (const char *); +extern char *tgetstr (const char *, char **); +extern void tputs (const char *, int, void (*)(int)); #ifdef __cplusplus } #endif @@ -107,7 +107,7 @@ static void term_get_fkeys (Lisp_Object keymap, char **address); column, so we use emchar_string_displayed_columns(). ****************************************************************************/ static int -tty_text_width (struct frame *f, struct face_cachel *cachel, CONST Emchar *str, +tty_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str, Charcount len) { return emchar_string_displayed_columns (str, len); @@ -289,7 +289,7 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, elt++; } } - /* #### RUNE_HLINE is actualy a little more complicated than this + /* #### RUNE_HLINE is actually a little more complicated than this but at the moment it is only used to draw a turned off modeline and this will suffice for that. */ else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE) @@ -333,77 +333,29 @@ tty_output_display_block (struct window *w, struct display_line *dl, int block, window, ERROR_ME_NOT, 1); if (IMAGE_INSTANCEP (instance)) - switch (XIMAGE_INSTANCE_TYPE (instance)) - { - case IMAGE_TEXT: + { + switch (XIMAGE_INSTANCE_TYPE (instance)) { - Bufbyte *temptemp; - Lisp_Object string = - XIMAGE_INSTANCE_TEXT_STRING (instance); - Bytecount len = XSTRING_LENGTH (string); - - /* In the unlikely instance that a garbage-collect - occurs during encoding, we at least need to - copy the string. - */ - temptemp = (Bufbyte *) alloca (len); - memcpy (temptemp, XSTRING_DATA (string), len); - { - int i; - - /* Now truncate the first rb->object.dglyph.xoffset - columns. */ - for (i = 0; i < rb->object.dglyph.xoffset;) - { -#ifdef MULE - Emchar ch = charptr_emchar (temptemp); - i += XCHARSET_COLUMNS (CHAR_CHARSET (ch)); -#else - i++; /* telescope this */ -#endif - INC_CHARPTR (temptemp); - } - - /* If we truncated one column too many, then - add a space at the beginning. */ - if (i > rb->object.dglyph.xoffset) - { - assert (i > 0); - *--temptemp = ' '; - i--; - } - len -= i; - } - - tty_output_bufbyte_string (w, dl, temptemp, len, - xpos, findex, 0); - - if (xpos >= cursor_start - && (cursor_start < - xpos + (bufbyte_string_displayed_columns - (temptemp, len)))) - { - cmgoto (f, dl->ypos - 1, cursor_start); - } + case IMAGE_MONO_PIXMAP: + case IMAGE_COLOR_PIXMAP: + case IMAGE_SUBWINDOW: + case IMAGE_WIDGET: + case IMAGE_LAYOUT: + /* just do nothing here */ + break; + + case IMAGE_NOTHING: + /* nothing is as nothing does */ + break; + + case IMAGE_TEXT: + case IMAGE_POINTER: + default: + abort (); } - break; - - case IMAGE_MONO_PIXMAP: - case IMAGE_COLOR_PIXMAP: - case IMAGE_SUBWINDOW: - /* just do nothing here */ - break; - - case IMAGE_POINTER: - abort (); - - case IMAGE_NOTHING: - /* nothing is as nothing does */ - break; - - default: - abort (); - } + IMAGE_INSTANCE_OPTIMIZE_OUTPUT + (XIMAGE_INSTANCE (instance)) = 0; + } xpos += rb->width; elt++; @@ -461,16 +413,14 @@ tty_output_vertical_divider (struct window *w, int clear) Clear the area in the box defined by the given parameters. ****************************************************************************/ static void -tty_clear_region (Lisp_Object window, face_index findex, int x, int y, - int width, int height) +tty_clear_region (Lisp_Object window, struct device* d, struct frame * f, + face_index findex, int x, int y, + int width, int height, Lisp_Object fcolor, Lisp_Object bcolor, + Lisp_Object background_pixmap) { - struct window *w = XWINDOW (window); - struct frame *f = XFRAME (w->frame); struct console *c = XCONSOLE (FRAME_CONSOLE (f)); int line; - - if (!width || !height) - return; + struct window* w = XWINDOW (window); tty_turn_on_face (w, findex); for (line = y; line < y + height; line++) @@ -534,7 +484,7 @@ tty_clear_to_window_end (struct window *w, int ypos1, int ypos2) Lisp_Object window; XSETWINDOW (window, w); - tty_clear_region (window, DEFAULT_INDEX, x, ypos1, width, ypos2 - ypos1); + redisplay_clear_region (window, DEFAULT_INDEX, x, ypos1, width, ypos2 - ypos1); } } @@ -566,7 +516,7 @@ tty_clear_frame (struct frame *f) clear_to_end (f); #else /* #### Not implemented. */ - fprintf (stderr, "Not yet.\n"); + stderr_out ("Not yet.\n"); #endif } tty_turn_off_frame_face (f, Vdefault_face); @@ -950,16 +900,16 @@ tty_redisplay_shutdown (struct console *c) { Lisp_Object dev = CONSOLE_SELECTED_DEVICE (c); - if (!GC_NILP (dev)) + if (!NILP (dev)) { Lisp_Object frm = DEVICE_SELECTED_FRAME (XDEVICE (dev)); - if (!GC_NILP (frm)) + if (!NILP (frm)) { struct frame *f = XFRAME (frm); /* Clear the bottom line of the frame. */ - tty_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0, + redisplay_clear_region (FRAME_SELECTED_WINDOW (f), DEFAULT_INDEX, 0, f->height, f->width, 1); /* And then stick the cursor there. */ @@ -1305,7 +1255,8 @@ init_tty_for_redisplay (struct device *d, char *terminal_type) struct fkey_table { - CONST char *cap, *name; + const char *cap; + const char *name; }; /* Termcap capability names that correspond directly to X keysyms. @@ -1437,7 +1388,7 @@ term_get_fkeys_1 (Lisp_Object function_key_map) char *sequence = tgetstr (keys[i].cap, address); if (sequence) Fdefine_key (function_key_map, - build_ext_string (sequence, FORMAT_BINARY), + build_ext_string (sequence, Qbinary), vector1 (intern (keys[i].name))); } @@ -1445,22 +1396,18 @@ term_get_fkeys_1 (Lisp_Object function_key_map) describes F10, whereas othertimes it describes F0 and "k;" describes F10. We will attempt to politely accommodate both systems by testing for "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. - */ + */ { - char *k_semi = tgetstr ("k;", address); - char *k0 = tgetstr ("k0", address); - CONST char *k0_name = "f10"; + const char *k_semi = tgetstr ("k;", address); + const char *k0 = tgetstr ("k0", address); if (k_semi) - { - Fdefine_key (function_key_map, build_ext_string (k_semi, FORMAT_BINARY), - vector1 (intern ("f10"))); - k0_name = "f0"; - } + Fdefine_key (function_key_map, build_ext_string (k_semi, Qbinary), + vector1 (intern ("f10"))); if (k0) - Fdefine_key (function_key_map, build_ext_string (k0, FORMAT_BINARY), - vector1 (intern (k0_name))); + Fdefine_key (function_key_map, build_ext_string (k0, Qbinary), + vector1 (intern (k_semi ? "f0" : "f10"))); } /* Set up cookies for numbered function keys above f10. */ @@ -1483,47 +1430,46 @@ term_get_fkeys_1 (Lisp_Object function_key_map) { sprintf (fkey, "f%d", i); Fdefine_key (function_key_map, - build_ext_string (sequence, FORMAT_BINARY), + build_ext_string (sequence, Qbinary), vector1 (intern (fkey))); } } } - } + } /* * Various mappings to try and get a better fit. */ - { -#define CONDITIONAL_REASSIGN(cap1, cap2, sym) \ - if (!tgetstr (cap1, address)) \ - { \ - char *sequence = tgetstr (cap2, address); \ - if (sequence) \ - Fdefine_key (function_key_map, \ - build_ext_string (sequence, FORMAT_BINARY), \ - vector1 (intern (sym))); \ - } +#define CONDITIONAL_REASSIGN(cap1, cap2, keyname) do { \ + if (!tgetstr (cap1, address)) \ + { \ + char *sequence = tgetstr (cap2, address); \ + if (sequence) \ + Fdefine_key (function_key_map, \ + build_ext_string (sequence, Qbinary), \ + vector1 (intern (keyname))); \ + } \ + } while (0) - /* if there's no key_next keycap, map key_npage to `next' keysym */ - CONDITIONAL_REASSIGN ("%5", "kN", "next"); - /* if there's no key_prev keycap, map key_ppage to `previous' keysym */ - CONDITIONAL_REASSIGN ("%8", "kP", "prior"); - /* if there's no key_dc keycap, map key_ic to `insert' keysym */ - CONDITIONAL_REASSIGN ("kD", "kI", "insert"); - - /* IBM has their own non-standard dialect of terminfo. - If the standard name isn't found, try the IBM name. */ - CONDITIONAL_REASSIGN ("kB", "KO", "backtab"); - CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */ - CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */ - CONDITIONAL_REASSIGN ("%7", "ki", "menu"); - CONDITIONAL_REASSIGN ("@7", "kw", "end"); - CONDITIONAL_REASSIGN ("F1", "k<", "f11"); - CONDITIONAL_REASSIGN ("F2", "k>", "f12"); - CONDITIONAL_REASSIGN ("%1", "kq", "help"); - CONDITIONAL_REASSIGN ("*6", "kU", "select"); + /* if there's no key_next keycap, map key_npage to `next' keysym */ + CONDITIONAL_REASSIGN ("%5", "kN", "next"); + /* if there's no key_prev keycap, map key_ppage to `previous' keysym */ + CONDITIONAL_REASSIGN ("%8", "kP", "prior"); + /* if there's no key_dc keycap, map key_ic to `insert' keysym */ + CONDITIONAL_REASSIGN ("kD", "kI", "insert"); + + /* IBM has their own non-standard dialect of terminfo. + If the standard name isn't found, try the IBM name. */ + CONDITIONAL_REASSIGN ("kB", "KO", "backtab"); + CONDITIONAL_REASSIGN ("@4", "kJ", "execute"); /* actually "action" */ + CONDITIONAL_REASSIGN ("@4", "kc", "execute"); /* actually "command" */ + CONDITIONAL_REASSIGN ("%7", "ki", "menu"); + CONDITIONAL_REASSIGN ("@7", "kw", "end"); + CONDITIONAL_REASSIGN ("F1", "k<", "f11"); + CONDITIONAL_REASSIGN ("F2", "k>", "f12"); + CONDITIONAL_REASSIGN ("%1", "kq", "help"); + CONDITIONAL_REASSIGN ("*6", "kU", "select"); #undef CONDITIONAL_REASSIGN - } return Qnil; }