… | |
… | |
306 | SECONDARY, |
306 | SECONDARY, |
307 | }; |
307 | }; |
308 | |
308 | |
309 | #define RS_None 0 |
309 | #define RS_None 0 |
310 | |
310 | |
|
|
311 | // GET_BGATTR depends on RS_fgShift > RS_bgShift |
311 | #define RS_colorMask ((1UL << Color_Bits) - 1UL) |
312 | #define RS_colorMask ((1UL << Color_Bits) - 1UL) |
312 | #define RS_bgShift 0 |
313 | #define RS_bgShift 0 |
313 | #define RS_fgShift (RS_bgShift + Color_Bits) |
314 | #define RS_fgShift (RS_bgShift + Color_Bits) |
314 | #define RS_bgMask (RS_colorMask << RS_bgShift) |
315 | #define RS_bgMask (RS_colorMask << RS_bgShift) |
315 | #define RS_fgMask (RS_colorMask << RS_fgShift) |
316 | #define RS_fgMask (RS_colorMask << RS_fgShift) |
316 | |
317 | |
317 | // font styles |
318 | // font styles |
318 | #define RS_Bold 0x08000000UL // value 1 |
319 | #define RS_Bold 0x08000000UL // value 1 |
319 | #define RS_Italic 0x10000000UL // value 2 |
320 | #define RS_Italic 0x10000000UL // value 2 |
320 | |
321 | |
|
|
322 | #define RS_styleCount 4 |
|
|
323 | #define RS_styleMask (RS_Bold | RS_Italic) |
|
|
324 | #define RS_styleShift 27 |
|
|
325 | |
321 | // fake styles |
326 | // fake styles |
322 | #define RS_Blink 0x20000000UL // blink |
327 | #define RS_Blink 0x20000000UL // blink |
323 | #define RS_RVid 0x40000000UL // reverse video |
328 | #define RS_RVid 0x40000000UL // reverse video |
324 | #define RS_Uline 0x80000000UL // underline |
329 | #define RS_Uline 0x80000000UL // underline |
325 | |
330 | |
… | |
… | |
333 | #define RS_Careful (1UL << RS_fontShift) /* be careful when drawing these */ |
338 | #define RS_Careful (1UL << RS_fontShift) /* be careful when drawing these */ |
334 | #define RS_fontMask ((rxvt_fontset::fontCount << (RS_fontShift + 1)) | RS_Careful) // includes RS_Careful |
339 | #define RS_fontMask ((rxvt_fontset::fontCount << (RS_fontShift + 1)) | RS_Careful) // includes RS_Careful |
335 | |
340 | |
336 | // toggle this to force redraw, must be != RS_Careful and otherwise "pretty neutral" |
341 | // toggle this to force redraw, must be != RS_Careful and otherwise "pretty neutral" |
337 | #define RS_redraw (2UL << RS_fontShift) |
342 | #define RS_redraw (2UL << RS_fontShift) |
338 | |
|
|
339 | #define RS_styleCount 4 |
|
|
340 | #define RS_styleMask (RS_Bold | RS_Italic) |
|
|
341 | #define RS_styleShift 27 |
|
|
342 | |
343 | |
343 | #define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline) |
344 | #define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline) |
344 | #define RS_attrMask (RS_baseattrMask | RS_fontMask) |
345 | #define RS_attrMask (RS_baseattrMask | RS_fontMask) |
345 | |
346 | |
346 | #define DEFAULT_RSTYLE (RS_None | (Color_fg << RS_fgShift) | (Color_bg << RS_bgShift)) |
347 | #define DEFAULT_RSTYLE (RS_None | (Color_fg << RS_fgShift) | (Color_bg << RS_bgShift)) |
… | |
… | |
637 | |
638 | |
638 | #define GET_STYLE(x) (((x) & RS_styleMask) >> RS_styleShift) |
639 | #define GET_STYLE(x) (((x) & RS_styleMask) >> RS_styleShift) |
639 | #define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift)) |
640 | #define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift)) |
640 | |
641 | |
641 | #define GET_ATTR(x) (((x) & RS_attrMask)) |
642 | #define GET_ATTR(x) (((x) & RS_attrMask)) |
|
|
643 | // return attributes defining the background, encoding doesn't matter |
|
|
644 | // depends on RS_fgShift > RS_bgShift |
642 | #define GET_BGATTR(x) \ |
645 | #define GET_BGATTR(x) \ |
|
|
646 | (expect_false ((x) & RS_RVid) \ |
643 | (((x) & RS_RVid) ? (((x) & (RS_attrMask & ~RS_RVid)) \ |
647 | ? (((x) & (RS_attrMask & ~RS_RVid)) \ |
644 | | (((x) & RS_colorMask) << RS_bgShift)) \ |
648 | | (((x) & RS_fgMask) >> (RS_fgShift - RS_bgShift))) \ |
645 | : ((x) & (RS_attrMask | RS_bgMask))) |
649 | : ((x) & (RS_attrMask | RS_bgMask))) |
646 | #define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift)) |
650 | #define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift)) |
647 | #define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift)) |
651 | #define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift)) |
648 | #define SET_ATTR(x,a) (((x) & ~RS_attrMask) | (a)) |
652 | #define SET_ATTR(x,a) (((x) & ~RS_attrMask) | (a)) |
649 | |
653 | |
650 | #define RS_SAME(a,b) (!(((a) ^ (b)) & ~RS_Careful)) |
654 | #define RS_SAME(a,b) (!(((a) ^ (b)) & ~RS_Careful)) |