--- rxvt-unicode/src/rxvt.h 2012/01/01 17:43:47 1.458 +++ rxvt-unicode/src/rxvt.h 2023/02/19 08:48:42 1.569 @@ -1,17 +1,17 @@ #ifndef RXVT_H_ /* include once only */ #define RXVT_H_ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #ifdef HAVE_STDINT_H #include #endif #include #include -#include +#include #include #ifdef HAVE_SYS_IOCTL_H #include @@ -20,15 +20,13 @@ #include #endif -#if HAVE_CWCHAR -# include -#elif HAVE_WCHAR_H +#if HAVE_WCHAR_H # include #else // stdlib.h might provide it #endif -using namespace std; +#include // we assume that Xlib.h defines XPointer, and it does since at least 1994... @@ -76,28 +74,24 @@ #include #include -#ifdef HAVE_AFTERIMAGE -# include -# undef min -# undef max -#endif - -#ifdef HAVE_PIXBUF +#if HAVE_PIXBUF # include #endif -#if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) -# define HAVE_BG_PIXMAP 1 +#if XRENDER && (HAVE_PIXBUF || ENABLE_TRANSPARENCY) +# define HAVE_IMG 1 #endif +#define ECB_NO_THREADS 1 +#include "ecb.h" + #include "encoding.h" #include "rxvtutil.h" #include "rxvtfont.h" #include "rxvttoolkit.h" +#include "rxvtimg.h" #include "scrollbar.h" #include "ev_cpp.h" -#include "salloc.h" -#include "libptytty.h" #include "rxvtperl.h" @@ -132,7 +126,15 @@ /****************************************************************************/ // exception thrown on fatal (per-instance) errors -class rxvt_failure_exception { }; +class rxvt_failure_exception : public std::exception +{ +public: + const char * + what () const noexcept override + { + return ""; + } +}; // exception thrown when the command parser runs out of input data class out_of_input { }; @@ -144,9 +146,9 @@ */ // main.C #define SET_LOCALE(locale) rxvt_set_locale (locale) -extern bool rxvt_set_locale (const char *locale) NOTHROW; -extern void rxvt_push_locale (const char *locale) NOTHROW; -extern void rxvt_pop_locale () NOTHROW; +extern bool rxvt_set_locale (const char *locale) noexcept; +extern void rxvt_push_locale (const char *locale) noexcept; +extern void rxvt_pop_locale () noexcept; void rxvt_init (); // misc.C @@ -155,26 +157,30 @@ char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); wchar_t * rxvt_utf8towcs (const char *str, int len = -1); -const char * rxvt_basename (const char *str) NOTHROW; -void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; -void rxvt_log (const char *fmt,...) NOTHROW; -void rxvt_warn (const char *fmt,...) NOTHROW; -void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) ecb_noreturn; -void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) ecb_noreturn; +const char * rxvt_basename (const char *str) noexcept; +void rxvt_vlog (const char *fmt, va_list arg_ptr) noexcept; +void rxvt_log (const char *fmt,...) noexcept; +void rxvt_warn (const char *fmt,...) noexcept; +ecb_noreturn ecb_cold +void rxvt_fatal (const char *fmt, ...); +ecb_noreturn ecb_cold +void rxvt_exit_failure (); + +void * rxvt_malloc (size_t size); +void * rxvt_calloc (size_t number, size_t size); +void * rxvt_realloc (void *ptr, size_t size); -char * rxvt_strtrim (char *str) NOTHROW; -char ** rxvt_strsplit (char delim, const char *str) NOTHROW; +char * rxvt_strtrim (char *str) noexcept; +char ** rxvt_strsplit (char delim, const char *str) noexcept; static inline void -rxvt_free_strsplit (char **ptr) NOTHROW +rxvt_free_strsplit (char **ptr) noexcept { free (ptr[0]); free (ptr); } -void * rxvt_malloc (size_t size); -void * rxvt_calloc (size_t number, size_t size); -void * rxvt_realloc (void *ptr, size_t size); +KeySym rxvt_XKeycodeToKeysym (Display *dpy, KeyCode keycode, int index); ///////////////////////////////////////////////////////////////////////////// @@ -183,17 +189,6 @@ extern char **rxvt_environ; // the original environ pointer static inline void -set_environ (stringvec *envv) -{ -#if ENABLE_PERL - assert (envv); -#else - if (envv) -#endif - environ = (char **)envv->begin (); -} - -static inline void set_environ (char **envv) { #if ENABLE_PERL @@ -271,7 +266,7 @@ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" -#ifdef BG_IMAGE_FROM_FILE +#if HAVE_IMG # define COLORTERMENVFULL COLORTERMENV "-xpm" #else # define COLORTERMENVFULL COLORTERMENV @@ -284,6 +279,23 @@ # endif #endif +// Hidden color cube for indexed 24-bit colors. There are fewer blue levels +// because normal human eye is less sensitive to the blue component than to +// the red or green. (https://en.m.wikipedia.org/wiki/Color_depth#8-bit_color) +#if USE_256_COLORS +// 7x7x5=245 < 254 unused color indices +# define Red_levels 7 +# define Green_levels 7 +# define Blue_levels 5 +#else +// 6x6x4=144 < 166 unused color indices +# define Red_levels 6 +# define Green_levels 6 +# define Blue_levels 4 +#endif + +#define RGB24_CUBE_SIZE (Red_levels * Green_levels * Blue_levels) + #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) # define NO_MOUSE_REPORT_SCROLLBAR 1 #endif @@ -322,9 +334,9 @@ /* modes for rxvt_term::scr_page () - scroll page. used by scrollbar window */ enum page_dirn { - UP, - DN, - NO_DIR, + DN = -1, + NO_DIR = 0, + UP = 1, }; /* arguments for rxvt_term::scr_change_screen () */ @@ -387,6 +399,12 @@ C0_DLE, C0_DC1, C0_DC2, D0_DC3, C0_DC4, C0_NAK, C0_SYN, C0_ETB, C0_CAN, C0_EM , C0_SUB, C0_ESC, C0_IS4, C0_IS3, C0_IS2, C0_IS1, }; + +struct string_term +{ + unsigned char v[3]; +}; + #define CHAR_ST 0x9c /* 0234 */ /* @@ -422,14 +440,12 @@ Rxvt_restoreFG = 39, Rxvt_restoreBG = 49, - Rxvt_Pixmap = 20, // new bg pixmap Rxvt_dumpscreen = 55, // dump scrollback and all of screen URxvt_locale = 701, // change locale URxvt_version = 702, // request version URxvt_Color_IT = 704, // change actual 'Italic' colour - URxvt_Color_tint = 705, // change actual tint colour URxvt_Color_BD = 706, // change actual 'Bold' color URxvt_Color_UL = 707, // change actual 'Underline' color URxvt_Color_border = 708, @@ -442,6 +458,7 @@ URxvt_view_up = 720, URxvt_view_down = 721, + URxvt_cellinfo = 776, // returns font cell width, height etc. URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;" }; @@ -487,6 +504,9 @@ #else maxTermCOLOR = Color_White + 72, #endif + minTermCOLOR24, + maxTermCOLOR24 = minTermCOLOR24 + + RGB24_CUBE_SIZE - 1, #ifndef NO_CURSORCOLOR Color_cursor, Color_cursor2, @@ -511,9 +531,6 @@ #ifdef RXVT_SCROLLBAR Color_trough, #endif -#if ENABLE_TRANSPARENCY - Color_tint, -#endif #if OFF_FOCUS_FADING Color_fade, #endif @@ -528,9 +545,13 @@ }; #if USE_256_COLORS -# define Color_Bits 9 // 0 .. maxTermCOLOR +# define Color_Bits 9 // 0 .. maxTermCOLOR24 #else -# define Color_Bits 7 // 0 .. maxTermCOLOR +# define Color_Bits 8 // 0 .. maxTermCOLOR24 +#endif + +#if maxTermCOLOR24 >= (1 << Color_Bits) +# error color index overflow #endif /* @@ -569,8 +590,11 @@ #define PrivMode_MouseBtnEvent (1UL<<20) #define PrivMode_MouseAnyEvent (1UL<<21) #define PrivMode_BracketPaste (1UL<<22) -#define PrivMode_ExtModeMouse (1UL<<23) // xterm pseudo-utf-8 hack -#define PrivMode_ExtMouseRight (1UL<<24) // xterm pseudo-utf-8, but works in non-utf-8-locales +#define PrivMode_ExtMouseUTF8 (1UL<<23) // xterm pseudo-utf-8 hack +#define PrivMode_ExtMouseUrxvt (1UL<<24) // xterm pseudo-utf-8, but works in non-utf-8-locales +#define PrivMode_BlinkingCursor (1UL<<25) +#define PrivMode_FocusEvent (1UL<<26) +#define PrivMode_ExtMouseSGR (1UL<<27) #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent) @@ -583,7 +607,7 @@ // do not change these constants lightly, there are many interdependencies #define IMBUFSIZ 128 // input modifier buffer sizes #define KBUFSZ 512 // size of keyboard mapping buffer -#define CBUFSIZ 2048 // size of command buffer +#define CBUFSIZ 32768 // size of command buffer (longest command sequence possible) #define CBUFCNT 8 // never call pty_fill/cmd_parse more than this often in a row #define UBUFSIZ 2048 // character buffer @@ -666,13 +690,6 @@ #define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift)) #define GET_ATTR(x) (((x) & RS_attrMask)) -// return attributes defining the background, encoding doesn't matter -// depends on RS_fgShift > RS_bgShift -#define GET_BGATTR(x) \ - (ecb_unlikely ((x) & RS_RVid) \ - ? (((x) & (RS_attrMask & ~RS_RVid)) \ - | (((x) & RS_fgMask) >> (RS_fgShift - RS_bgShift))) \ - : ((x) & (RS_attrMask | RS_bgMask))) #define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift)) #define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift)) #define SET_ATTR(x,a) (((x) & ~RS_attrMask) | (a)) @@ -708,6 +725,16 @@ tlen_t_ l; // length of each text line uint32_t f; // flags + bool valid () + { + return l >= 0; + } + + void alloc () + { + l = 0; + } + bool is_longer () { return f & LINE_LONGER; @@ -760,8 +787,8 @@ #define UNICODE_MASK 0x1fffffUL #if UNICODE_3 -# define COMPOSE_LO 0x40000000UL -# define COMPOSE_HI 0x400fffffUL +# define COMPOSE_LO 0x110000UL +# define COMPOSE_HI 0x1fffffUL # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) #else # if ENABLE_PERL @@ -780,18 +807,23 @@ // not fitting in the BMP. struct compose_char { - unicode_t c1, c2; // any chars != NOCHAR are valid + // c1 can be any character != NOCHAR, including another compose character + // c2 must always be a zero-width character or NOCHAR, in case + // this just extends beyond the BMP. + unicode_t c1, c2; + compose_char (unicode_t c1, unicode_t c2) : c1(c1), c2(c2) { } }; -class rxvt_composite_vec +struct rxvt_composite_vec { vector v; -public: + text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); - int expand (unicode_t c, wchar_t *r); + template int expand (unicode_t c, T *r); + int expand (unicode_t c) { return expand (c, (text_t *)0); } compose_char *operator [](text_t c) { return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () @@ -803,6 +835,65 @@ extern class rxvt_composite_vec rxvt_composite; #endif +#if 0 +// expand the sequence into a static array +// works even without ENABLE_COMBINING +template +struct rxvt_compose_expand_static +{ +#if ENABLE_COMBINING + enum { max_size = max_size_ }; + + T chrs[max_size]; + + // expand sequence and return start ptr + // guarantees at least one output + // get the length with length () on that ptr + T *operator ()(unicode_t c) + { + T *cur = chrs + max_size; + + while (ecb_expect_false (IS_COMPOSE (c))) + if (ecb_expect_true (c - COMPOSE_LO < rxvt_composite.v.size ())) + { + compose_char *cc = &rxvt_composite.v [c - COMPOSE_LO]; + + if (cc->c2 != NOCHAR) + { + cur -= cur > chrs; *cur = cc->c2; + } + + c = cc->c1; + } + else + c = NOCHAR; + + cur -= cur > chrs; *cur = c; + + return cur; + } + + int length (T *first) + { + return chrs + max_size - first; + } +#else + T chr; + + T *operator ()(text_t c); + { + chr = c; + return &chr; + } + + int length (T *first) + { + return 1; + } +#endif +}; +#endif + /****************************************************************************/ #ifdef KEYSYM_RESOURCE @@ -872,6 +963,8 @@ struct TermWin_t { + int vt_width; /* actual window width [pixels] */ + int vt_height; /* actual window height [pixels] */ int width; /* window width [pixels] */ int height; /* window height [pixels] */ int fwidth; /* font width [pixels] */ @@ -893,7 +986,6 @@ Window parent; /* parent identifier */ Window vt; /* vt100 window */ GC gc; /* GC for drawing */ - Pixmap pixmap; rxvt_drawable *drawable; rxvt_fontset *fontset[4]; }; @@ -983,6 +1075,7 @@ XSizeHints szHint; rxvt_color *pix_colors; Cursor TermWin_cursor; /* cursor for vt window */ + line_t *row_buf; // all lines, scrollback + terminal, circular line_t *drawn_buf; // text on screen line_t *swap_buf; // lines for swap buffer @@ -1017,6 +1110,8 @@ bypass_keystate:1, #if ENABLE_FRILLS urgency_hint:1, + rewrap_always:1, + rewrap_never:1, #endif #if CURSOR_BLINK hidden_cursor:1, @@ -1030,6 +1125,7 @@ enc_utf8:1, /* whether locale uses utf-8 */ seen_input:1, /* whether we have seen some program output yet */ seen_resize:1, /* whether we had a resize event */ + init_done:1, parsed_geometry:1; unsigned char refresh_type, @@ -1049,7 +1145,6 @@ /* ---------- */ #ifdef SELECTION_SCROLLING int scroll_selection_lines; - enum page_dirn scroll_selection_dir; int selection_save_x, selection_save_y, selection_save_state; @@ -1068,13 +1163,13 @@ # ifdef POINTER_BLANK pointerBlankDelay, # endif + multiClickTime, + cursor_type, allowedxerror; /* ---------- */ unsigned int ModLevel3Mask, ModMetaMask, ModNumLockMask; - int old_width, /* last used width in screen resize */ - old_height; /* last used height in screen resize */ unsigned long priv_modes, SavedModes; /* ---------- */ @@ -1089,144 +1184,41 @@ XComposeStatus compose; static struct termios def_tio; row_col_t oldcursor; -#ifdef HAVE_BG_PIXMAP - void bg_init (); - void bg_destroy (); +#ifdef HAVE_IMG enum { - //subset returned by make_transparency_pixmap - BG_IS_VALID = 1 << 0, - BG_NEEDS_TINT = 1 << 1, - BG_NEEDS_BLUR = 1 << 2, - - BG_EFFECTS_FLAGS = BG_NEEDS_TINT | BG_NEEDS_BLUR, - - BG_KEEP_ASPECT = 1 << 3, - BG_ROOT_ALIGN = 1 << 4, - BG_TILE = 1 << 14, - BG_GEOMETRY_FLAGS = BG_KEEP_ASPECT | BG_ROOT_ALIGN | BG_TILE, - - BG_TINT_SET = 1 << 5, - BG_TINT_BITAND = 1 << 6, - BG_TINT_FLAGS = BG_NEEDS_TINT | BG_TINT_BITAND, - - BG_HAS_RENDER = 1 << 7, - BG_HAS_RENDER_CONV = 1 << 8, - BG_CLIENT_RENDER = 1 << 9, - - BG_IS_TRANSPARENT = 1 << 10, - BG_NEEDS_REFRESH = 1 << 11, - BG_IS_SIZE_SENSITIVE = 1 << 12, - BG_IS_FROM_FILE = 1 << 13, + BG_IS_TRANSPARENT = 1 << 1, + BG_NEEDS_REFRESH = 1 << 2, }; - unsigned int bg_flags; - -# ifdef BG_IMAGE_FROM_FILE - void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y); - bool render_image (unsigned long tr_flags); - - enum { - noScale = 0, - windowScale = 100, - defaultScale = windowScale, - centerAlign = 50, - defaultAlign = centerAlign, - }; - - unsigned int h_scale, v_scale; /* percents of the window size */ - int h_align, v_align; /* percents of the window size: - 0 - left align, 50 - center, 100 - right */ - - bool bg_set_geometry (const char *geom, bool update = false); - void bg_set_default_geometry () - { - h_scale = v_scale = defaultScale; - h_align = v_align = defaultAlign; - } - - bool bg_set_file (const char *file); -# endif - -# ifdef ENABLE_TRANSPARENCY - Pixmap root_pixmap; /* current root pixmap set */ - rxvt_color tint; - int shade; - int h_blurRadius, v_blurRadius; - - bool bg_set_transparent (); - void bg_set_root_pixmap (); - void set_tint_shade_flags (); - bool bg_set_tint (rxvt_color &new_tint); - bool bg_set_shade (const char *shade_str); - bool bg_set_blur (const char *geom); - - bool blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height); - bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height); - void tint_ximage (Visual *visual, XImage *ximage); - unsigned long make_transparency_pixmap (); -# endif - - ev_tstamp bg_valid_since; - - Pixmap bg_pixmap; - unsigned int bg_pmap_width, bg_pmap_height; - - int target_x; - int target_y; - bool bg_set_position (int x, int y); - bool bg_window_size_sensitive (); - bool bg_window_position_sensitive (); - - bool bg_render (); - void bg_invalidate () - { - bg_flags &= ~BG_IS_VALID; - } -#endif -#ifdef HAVE_AFTERIMAGE - ASImage *original_asim; - ASVisual *asv; - ASImageManager *asimman; + uint8_t bg_flags; - void init_asv () - { - if (!asv) - asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); - } -#endif -#ifdef HAVE_PIXBUF - GdkPixbuf *pixbuf; - bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, - int src_x, int src_y, int dst_x, int dst_y, - unsigned int width, unsigned int height); + rxvt_img *bg_img; #endif #if ENABLE_OVERLAY overlay_base ov; - void scr_swap_overlay () NOTHROW; - void scr_overlay_new (int x, int y, int w, int h) NOTHROW; - void scr_overlay_off () NOTHROW; + void scr_swap_overlay () noexcept; + void scr_overlay_new (int x, int y, int w, int h) noexcept; + void scr_overlay_off () noexcept; void scr_overlay_set (int x, int y, text_t text, - rend_t rend = OVERLAY_RSTYLE) NOTHROW; - void scr_overlay_set (int x, int y, const char *s) NOTHROW; - void scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW; + rend_t rend = OVERLAY_RSTYLE) noexcept; + void scr_overlay_set (int x, int y, const char *s) noexcept; + void scr_overlay_set (int x, int y, const wchar_t *s) noexcept; #endif vector allocated; // free these memory blocks with free() - char env_windowid[21]; /* environmental variable WINDOWID */ - char env_colorfgbg[sizeof ("COLORFGBG=default;default;bg") + 1]; - char *env_display; /* environmental variable DISPLAY */ - char *env_term; /* environmental variable TERM */ + int parent_x, parent_y; // parent window position relative to root, only updated on demand char *locale; char charsets[4]; char *v_buffer; /* pointer to physical buffer */ unsigned int v_buflen; /* size of area to write */ stringvec *argv, *envv; /* if != 0, will be freed at destroy time */ + char **env; #ifdef KEYSYM_RESOURCE keyboard_manager *keyboard; @@ -1242,8 +1234,14 @@ ptytty *pty; - rxvt_salloc *talloc; // text line allocator - rxvt_salloc *ralloc; // rend line allocator + // chunk contains all line_t's as well as rend_t and text_t buffers + // for drawn_buf, swap_buf and row_buf, in this order + void *chunk; + size_t chunk_size; + + uint32_t rgb24_color[RGB24_CUBE_SIZE]; // the 24-bit color value + uint16_t rgb24_seqno[RGB24_CUBE_SIZE]; // which one is older? + uint16_t rgb24_sequence; static vector termlist; // a vector of all running rxvt_term's @@ -1252,27 +1250,22 @@ unicode_t iso14755buf; void commit_iso14755 (); # if ISO_14755 - void iso14755_51 (unicode_t ch, rend_t r = DEFAULT_RSTYLE, int x = 0, int y = -1); + void iso14755_51 (unicode_t ch, rend_t r = DEFAULT_RSTYLE, int x = 0, int y = -1, int y2 = -1); void iso14755_54 (int x, int y); # endif #endif long vt_emask, vt_emask_perl, vt_emask_xim, vt_emask_mouse; - void vt_select_input () const NOTHROW + void vt_select_input () const noexcept { XSelectInput (dpy, vt, vt_emask | vt_emask_perl | vt_emask_xim | vt_emask_mouse); } -#if ENABLE_TRANSPARENCY || ENABLE_PERL +#if ENABLE_PERL void rootwin_cb (XEvent &xev); xevent_watcher rootwin_ev; #endif -#ifdef HAVE_BG_PIXMAP - void update_background (); - void update_background_cb (ev::timer &w, int revents); - ev::timer update_background_ev; -#endif void x_cb (XEvent &xev); xevent_watcher termwin_ev; @@ -1290,6 +1283,7 @@ void pty_cb (ev::io &w, int revents); ev::io pty_ev; #ifdef CURSOR_BLINK + void cursor_blink_reset (); void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; #endif #ifdef TEXT_BLINK @@ -1316,13 +1310,15 @@ void pointer_unblank (); void tt_printf (const char *fmt,...); + void tt_write_ (const char *data, unsigned int len); void tt_write (const char *data, unsigned int len); + void tt_write_user_input (const char *data, unsigned int len); void pty_write (); void make_current () const // make this the "currently active" urxvt instance { SET_R (this); - set_environ (envv); + set_environ (env); rxvt_set_locale (locale); } @@ -1335,7 +1331,7 @@ void im_destroy (); void im_cb (); im_watcher im_ev; void im_set_size (XRectangle &size); - void im_set_position (XPoint &pos) NOTHROW; + void im_set_position (XPoint &pos) noexcept; void im_set_color (unsigned long &fg, unsigned long &bg); void im_set_preedit_area (XRectangle &preedit_rect, XRectangle &status_rect, const XRectangle &needed_rect); @@ -1349,10 +1345,10 @@ void key_press (XKeyEvent &ev); void key_release (XKeyEvent &ev); - wchar_t next_char () NOTHROW; - wchar_t cmd_getc () THROW ((class out_of_input)); - uint32_t next_octet () NOTHROW; - uint32_t cmd_get8 () THROW ((class out_of_input)); + wchar_t next_char () noexcept; + wchar_t cmd_getc (); + uint32_t next_octet () noexcept; + uint32_t cmd_get8 (); void cmd_parse (); void mouse_report (XButtonEvent &ev); @@ -1365,7 +1361,7 @@ #else void set_urgency (bool enable) { } #endif - void update_fade_color (unsigned int idx); + void update_fade_color (unsigned int idx, bool first_time = false); #ifdef PRINTPIPE FILE *popen_printer (); int pclose_printer (FILE *stream); @@ -1376,14 +1372,16 @@ void process_escape_seq (); void process_csi_seq (); void process_window_ops (const int *args, unsigned int nargs); - char *get_to_st (unicode_t &ends_how); + char *get_to_st (string_term &st); void process_dcs_seq (); void process_osc_seq (); - void process_color_seq (int report, int color, const char *str, char resp); - void process_xterm_seq (int op, char *str, char resp); + void process_color_seq (int report, int color, const char *str, string_term &st); + void process_xterm_seq (int op, char *str, string_term &st); + unsigned int map_rgb24_color (unsigned int r, unsigned int g, unsigned int b, unsigned int a); int privcases (int mode, unsigned long bit); void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); void process_sgr_mode (unsigned int nargs, const int *arg); + void set_cursor_style (int style); // init.C void init (stringvec *argv, stringvec *envv); void init (int argc, const char *const *argv, const char *const *envv); @@ -1398,7 +1396,7 @@ int run_child (const char *const *argv); void color_aliases (int idx); void create_windows (int argc, const char *const *argv); - void get_colours (); + void get_colors (); void get_ourmods (); void set_icon (const char *file); // main.C @@ -1407,7 +1405,7 @@ ~rxvt_term (); void destroy (); void emergency_cleanup (); - void recolour_cursor (); + void recolor_cursor (); void resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent); void window_calc (unsigned int newwidth, unsigned int newheight); bool set_fonts (); @@ -1417,44 +1415,22 @@ void set_title (const char *str); void set_icon_name (const char *str); void set_window_color (int idx, const char *color); - void set_colorfgbg (); + char *get_colorfgbg (); bool set_color (rxvt_color &color, const char *name); void alias_color (int dst, int src); void set_widthheight (unsigned int newwidth, unsigned int newheight); void get_window_origin (int &x, int &y); - Pixmap get_pixmap_property (Atom property); // screen.C - void lalloc (line_t &l) const + bool option (uint8_t opt) const noexcept { - l.t = (text_t *)talloc->alloc (); - l.r = (rend_t *)ralloc->alloc (); + return options[opt >> 3] & (1 << (opt & 7)); } -#if 0 - void lfree (line_t &l) - { - talloc->free (l.t); - ralloc->free (l.r); - } -#endif + void set_option (uint8_t opt, bool set = true) noexcept; - void lresize (line_t &l) const - { - if (!l.t) - return; - - l.t = (text_t *)talloc->alloc (l.t, prev_ncol * sizeof (text_t)); - l.r = (rend_t *)ralloc->alloc (l.r, prev_ncol * sizeof (rend_t)); - - l.l = min (l.l, ncol); - - if (ncol > prev_ncol) - scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE); - } - - int fgcolor_of (rend_t r) const NOTHROW + int fgcolor_of (rend_t r) const noexcept { int base = GET_BASEFG (r); #ifndef NO_BRIGHTCOLOR @@ -1468,7 +1444,7 @@ return base; } - int bgcolor_of (rend_t r) const NOTHROW + int bgcolor_of (rend_t r) const noexcept { int base = GET_BASEBG (r); #ifndef NO_BRIGHTCOLOR @@ -1482,96 +1458,104 @@ return base; } - bool option (uint8_t opt) const NOTHROW - { - return options[opt >> 3] & (1 << (opt & 7)); - } - - void set_option (uint8_t opt, bool set = true) NOTHROW; - // modifies first argument(!) - void tt_paste (char *data, unsigned int len) NOTHROW; - void paste (char *data, unsigned int len) NOTHROW; - void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; - void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; - void scr_kill_char (line_t &l, int col) const NOTHROW; - int scr_scroll_text (int row1, int row2, int count) NOTHROW; + void tt_paste (char *data, unsigned int len) noexcept; + void paste (char *data, unsigned int len) noexcept; + void scr_alloc () noexcept; + void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const noexcept; + void scr_blank_screen_mem (line_t &l, rend_t efs) const noexcept; + void scr_kill_char (line_t &l, int col) const noexcept; + void scr_set_char_rend (line_t &l, int col, rend_t rend); + int scr_scroll_text (int row1, int row2, int count) noexcept; + void copy_line (line_t &dst, line_t &src); void scr_reset (); - void scr_release () NOTHROW; - void scr_clear (bool really = false) NOTHROW; - void scr_refresh () NOTHROW; - bool scr_refresh_rend (rend_t mask, rend_t value) NOTHROW; - void scr_erase_screen (int mode) NOTHROW; + void scr_release () noexcept; + void scr_clear (bool really = false) noexcept; + void scr_refresh () noexcept; + bool scr_refresh_rend (rend_t mask, rend_t value) noexcept; + void scr_erase_screen (int mode) noexcept; #if ENABLE_FRILLS - void scr_erase_savelines () NOTHROW; - void scr_backindex () NOTHROW; - void scr_forwardindex () NOTHROW; -#endif - void scr_touch (bool refresh) NOTHROW; - void scr_expose (int x, int y, int width, int height, bool refresh) NOTHROW; - void scr_recolour (bool refresh = true) NOTHROW; - void scr_remap_chars () NOTHROW; - void scr_remap_chars (line_t &l) NOTHROW; + void scr_erase_savelines () noexcept; + void scr_backindex () noexcept; + void scr_forwardindex () noexcept; +#endif + void scr_touch (bool refresh) noexcept; + void scr_expose (int x, int y, int width, int height, bool refresh) noexcept; + void scr_recolor (bool refresh = true) noexcept; + void scr_remap_chars () noexcept; + void scr_remap_chars (line_t &l) noexcept; enum cursor_mode { SAVE, RESTORE }; void scr_poweron (); - void scr_soft_reset () NOTHROW; - void scr_cursor (cursor_mode mode) NOTHROW; - void scr_do_wrap () NOTHROW; - void scr_swap_screen () NOTHROW; + void scr_soft_reset () noexcept; + void scr_cursor (cursor_mode mode) noexcept; + void scr_do_wrap () noexcept; + void scr_swap_screen () noexcept; void scr_change_screen (int scrn); - void scr_color (unsigned int color, int fgbg) NOTHROW; - void scr_rendition (int set, int style) NOTHROW; - void scr_add_lines (const wchar_t *str, int len, int minlines = 0) NOTHROW; - void scr_backspace () NOTHROW; - void scr_tab (int count, bool ht = false) NOTHROW; - void scr_gotorc (int row, int col, int relative) NOTHROW; - void scr_index (enum page_dirn direction) NOTHROW; - void scr_erase_line (int mode) NOTHROW; - void scr_E () NOTHROW; - void scr_insdel_lines (int count, int insdel) NOTHROW; - void scr_insdel_chars (int count, int insdel) NOTHROW; - void scr_scroll_region (int top, int bot) NOTHROW; - void scr_cursor_visible (int mode) NOTHROW; - void scr_autowrap (int mode) NOTHROW; - void scr_relative_origin (int mode) NOTHROW; - void scr_insert_mode (int mode) NOTHROW; - void scr_set_tab (int mode) NOTHROW; - void scr_rvideo_mode (bool on) NOTHROW; - void scr_report_position () NOTHROW; - void set_font_style () NOTHROW; - void scr_charset_choose (int set) NOTHROW; - void scr_charset_set (int set, unsigned int ch) NOTHROW; - void scr_move_to (int y, int len) NOTHROW; - bool scr_page (enum page_dirn direction, int nlines) NOTHROW; - bool scr_changeview (int new_view_start) NOTHROW; - void scr_bell () NOTHROW; - void scr_printscreen (int fullhist) NOTHROW; - void scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) NOTHROW; - void scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) NOTHROW; - void scr_reverse_selection () NOTHROW; - void scr_dump (int fd) NOTHROW; - - void selection_check (int check_more) NOTHROW; - void selection_request (Time tm, int selnum = Sel_Primary) NOTHROW; - void selection_clear (bool clipboard = false) NOTHROW; + void scr_color (unsigned int color, int fgbg) noexcept; + void scr_rendition (int set, int style) noexcept; + void scr_add_lines (const wchar_t *str, int len, int minlines = 0) noexcept; + void scr_backspace () noexcept; + void scr_tab (int count, bool ht = false) noexcept; + void scr_gotorc (int row, int col, int relative) noexcept; + void scr_index (enum page_dirn direction) noexcept; + void scr_erase_line (int mode) noexcept; + void scr_E () noexcept; + void scr_insdel_lines (int count, int insdel) noexcept; + void scr_insdel_chars (int count, int insdel) noexcept; + void scr_scroll_region (int top, int bot) noexcept; + void scr_cursor_visible (int mode) noexcept; + void scr_autowrap (int mode) noexcept; + void scr_relative_origin (int mode) noexcept; + void scr_insert_mode (int mode) noexcept; + void scr_set_tab (int mode) noexcept; + void scr_rvideo_mode (bool on) noexcept; + void scr_report_position () noexcept; + void set_font_style () noexcept; + void scr_charset_choose (int set) noexcept; + void scr_charset_set (int set, unsigned int ch) noexcept; + void scr_move_to (int y, int len) noexcept; + bool scr_page (int nlines) noexcept; + bool scr_page (enum page_dirn direction, int nlines) noexcept + { + return scr_page (direction * nlines); + } + bool scr_changeview (int new_view_start) noexcept; + void scr_bell () noexcept; + void scr_printscreen (int fullhist) noexcept; + void scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2) noexcept; + void scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) noexcept; + void scr_reverse_selection () noexcept; + void scr_dump (int fd) noexcept; + + void selection_check (int check_more) noexcept; + void selection_changed () noexcept; /* sets want_refresh, corrects coordinates */ + void selection_request (Time tm, int selnum = Sel_Primary) noexcept; + void selection_clear (bool clipboard = false) noexcept; void selection_make (Time tm); - bool selection_grab (Time tm, bool clipboard = false) NOTHROW; - void selection_start_colrow (int col, int row) NOTHROW; - void selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) NOTHROW; - void selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) NOTHROW; - void selection_remove_trailing_spaces () NOTHROW; - void selection_send (const XSelectionRequestEvent &rq) NOTHROW; - void selection_click (int clicks, int x, int y) NOTHROW; - void selection_extend (int x, int y, int flag) NOTHROW; - void selection_rotate (int x, int y) NOTHROW; + bool selection_grab (Time tm, bool clipboard = false) noexcept; + void selection_start_colrow (int col, int row) noexcept; + void selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) noexcept; + void selection_extend_colrow (int32_t col, int32_t row, int button3, int buttonpress, int clickchange) noexcept; + void selection_remove_trailing_spaces () noexcept; + void selection_send (const XSelectionRequestEvent &rq) noexcept; + void selection_click (int clicks, int x, int y) noexcept; + void selection_extend (int x, int y, int flag) noexcept; + void selection_rotate (int x, int y) noexcept; // xdefaults.C + void rxvt_usage (int type); const char **get_options (int argc, const char *const *argv); - int parse_keysym (const char *str, const char *arg); + int parse_keysym (const char *str, unsigned int &state); + int bind_action (const char *str, const char *arg); const char *x_resource (const char *name); void extract_resources (); + void enumerate_resources (void (*cb)(rxvt_term *, const char *, const char *), const char *name_p = 0, const char *class_p = 0); + void enumerate_keysym_resources (void (*cb)(rxvt_term *, const char *, const char *)) + { + enumerate_resources (cb, "keysym", "Keysym"); + } void extract_keysym_resources (); };