--- rxvt-unicode/src/rxvt.h 2005/12/20 20:58:31 1.164 +++ rxvt-unicode/src/rxvt.h 2005/12/31 17:16:17 1.174 @@ -164,18 +164,6 @@ unsigned int button; /* detail */ }; -#define MAX_IT(current, other) if ((other) > (current)) (current) = (other) -#define MIN_IT(current, other) if ((other) < (current)) (current) = (other) -#define SWAP_IT(one, two, typeof) \ - do { \ - typeof swapittmp; \ - (swapittmp) = (one); (one) = (two); (two) = (swapittmp); \ - } while (/* CONSTCOND */ 0) -#define BOUND_POSITIVE_INT16(val) \ - (int16_t) ((val) <= 0 \ - ? 0 \ - : min ((val), (((uint16_t)-1)>>1))) - #if ENABLE_FRILLS typedef struct _mwmhints { CARD32 flags; @@ -365,9 +353,9 @@ /* flags for rxvt_scr_gotorc () */ enum { - C_RELATIVE = 1 , /* col movement is relative */ - R_RELATIVE = 2, /* row movement is relative */ - RELATIVE = 1 | 2, + C_RELATIVE = 1, /* col movement is relative */ + R_RELATIVE = 2, /* row movement is relative */ + RELATIVE = C_RELATIVE | R_RELATIVE, }; /* modes for rxvt_scr_insdel_chars (), rxvt_scr_insdel_lines () */ @@ -643,12 +631,14 @@ Rs_transparent_all, #endif #if ENABLE_FRILLS + Rs_pty_fd, + Rs_hold, Rs_ext_bwidth, Rs_int_bwidth, Rs_borderLess, Rs_lineSpace, - Rs_pty_fd, Rs_cursorUnderline, + Rs_intensityStyles, #endif #if CURSOR_BLINK Rs_cursorBlink, @@ -827,29 +817,18 @@ #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) -#define TermWin_TotalWidth() ((int32_t)width) -#define TermWin_TotalHeight() ((int32_t)height) +#define TermWin_TotalWidth() ((int32_t)this->width) +#define TermWin_TotalHeight() ((int32_t)this->height) + +// for m >= -n, ensure remainder lies between 0..n-1 +#define MOD(m,n) (((m) + (n)) % (n)) + +#define LINENO(n) MOD (term_start + int(n), total_rows) +#define ROW(n) row_buf [LINENO (n)] /* how to build & extract colors and attributes */ #define GET_BASEFG(x) (((x) & RS_fgMask)) #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) -#ifndef NO_BRIGHTCOLOR -# define GET_FGCOLOR(x) \ - ((((x) & RS_Bold) == 0 \ - || GET_BASEFG (x) < minCOLOR \ - || GET_BASEFG (x) >= minBrightCOLOR) \ - ? GET_BASEFG (x) \ - : (GET_BASEFG (x) + (minBrightCOLOR - minCOLOR))) -# define GET_BGCOLOR(x) \ - ((((x) & RS_Blink) == 0 \ - || GET_BASEBG (x) < minCOLOR \ - || GET_BASEBG (x) >= minBrightCOLOR) \ - ? GET_BASEBG (x) \ - : (GET_BASEBG (x) + (minBrightCOLOR - minCOLOR))) -#else -# define GET_FGCOLOR(x) GET_BASEFG(x) -# define GET_BGCOLOR(x) GET_BASEBG(x) -#endif #define GET_FONT(x) (((x) & RS_fontMask) >> RS_fontShift) #define SET_FONT(x,fid) (((x) & ~RS_fontMask) | ((fid) << RS_fontShift)) @@ -966,6 +945,7 @@ extern class rxvt_failure_exception { } rxvt_failure_exception; typedef callback1 log_callback; +typedef callback1 getfd_callback; extern void rxvt_vlog (const char *fmt, va_list arg_ptr); extern void rxvt_log (const char *fmt, ...); @@ -1052,6 +1032,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { log_callback *log_hook; // log error messages through this hook, if != 0 + getfd_callback *getfd_hook; // convert remote to local fd, if != 0 struct mbstate mbstate; // current input multibyte state @@ -1266,7 +1247,7 @@ void commit_iso14755 (); int hex_keyval (XKeyEvent &ev); # if ISO_14755 - void iso14755_51 (unicode_t ch, rend_t r = DEFAULT_RSTYLE); + void iso14755_51 (unicode_t ch, rend_t r = DEFAULT_RSTYLE, int x = 0, int y = -1); void iso14755_54 (int x, int y); # endif #endif @@ -1330,6 +1311,7 @@ rxvt_term (); ~rxvt_term (); + void child_exit (); // child has exited, usually destroys void destroy (); void emergency_cleanup (); @@ -1476,11 +1458,13 @@ l.r = (rend_t *)ralloc->alloc (); } +#if 0 void lfree (line_t &l) { talloc->free (l.t); ralloc->free (l.r); } +#endif void lresize (line_t &l) { @@ -1490,17 +1474,40 @@ 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)); - MIN_IT (l.l, (int16_t)ncol); + 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) + { + int base = GET_BASEFG (r); +#ifndef NO_BRIGHTCOLOR + if (r & RS_Bold + && (!ENABLE_STYLES || OPTION (Opt_intensityStyles)) + && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) + base += minBrightCOLOR - minCOLOR; +#endif + return base; + } + + int bgcolor_of (rend_t r) + { + int base = GET_BASEBG (r); +#ifndef NO_BRIGHTCOLOR + if (r & RS_Blink + && (!ENABLE_STYLES || OPTION (Opt_intensityStyles)) + && IN_RANGE_INC (base, minCOLOR, minBrightCOLOR)) + base += minBrightCOLOR - minCOLOR; +#endif + return base; + } + void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs); void scr_blank_screen_mem (line_t &l, rend_t efs); int scr_scroll_text (int row1, int row2, int count); void scr_reset (); - void scr_reset_realloc (); void scr_release (); void scr_clear (bool really = false); void scr_refresh (unsigned char refresh_type);