ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvt.h
(Generate patch)

Comparing rxvt-unicode/src/rxvt.h (file contents):
Revision 1.394 by root, Thu Apr 1 00:29:22 2010 UTC vs.
Revision 1.398 by root, Thu Apr 1 01:03:20 2010 UTC

304enum { 304enum {
305 PRIMARY = 0, 305 PRIMARY = 0,
306 SECONDARY, 306 SECONDARY,
307}; 307};
308 308
309// define various rendition bits and masks. the rendition word
310// is 32 bits in size, and we should use it as efficiently as possible
311
309#define RS_None 0 312#define RS_None 0
310 313
314// GET_BGATTR depends on RS_fgShift > RS_bgShift
311#define RS_colorMask ((1UL << Color_Bits) - 1UL) 315#define RS_colorMask ((1UL << Color_Bits) - 1UL)
312#define RS_fgShift Color_Bits
313#define RS_bgShift 0 316#define RS_bgShift 0
317#define RS_fgShift (RS_bgShift + Color_Bits)
318#define RS_bgMask (RS_colorMask << RS_bgShift)
314#define RS_fgMask (RS_colorMask << RS_fgShift) 319#define RS_fgMask (RS_colorMask << RS_fgShift)
315#define RS_bgMask (RS_colorMask << RS_bgShift)
316
317// font styles
318#define RS_Bold 0x08000000UL // value 1
319#define RS_Italic 0x10000000UL // value 2
320
321// fake styles
322#define RS_Blink 0x20000000UL // blink
323#define RS_RVid 0x40000000UL // reverse video
324#define RS_Uline 0x80000000UL // underline
325
326// 5 custom bits for extensions
327#define RS_customCount 16
328#define RS_customMask 0x07800000UL
329#define RS_customShift 23
330 320
331// must have space for rxvt_fontset::fontCount * 2 + 2 values 321// must have space for rxvt_fontset::fontCount * 2 + 2 values
332#define RS_fontMask 0x007c0000UL // includes RS_Careful 322#define RS_fontShift (RS_fgShift + Color_Bits)
333#define RS_fontShift 18
334#define RS_Careful (1UL << RS_fontShift) /* be careful when drawing these */ 323#define RS_Careful (1UL << RS_fontShift) /* be careful when drawing these */
324#define RS_fontMask ((rxvt_fontset::fontCount << (RS_fontShift + 1)) | RS_Careful) // includes RS_Careful
335 325
336// toggle this to force redraw, must be != RS_Careful and otherwise "pretty neutral" 326// toggle this to force redraw, must be != RS_Careful and otherwise "pretty neutral"
337#define RS_redraw (2UL << RS_fontShift) 327#define RS_redraw (2UL << RS_fontShift)
338 328
329// 5 custom bits for extensions
330#define RS_customCount 16UL
331#define RS_customShift 23
332#define RS_customMask ((RS_customCount - 1UL) << RS_customShift)
333
334// font styles
335#define RS_Bold (1UL << RS_styleShift)
336#define RS_Italic (2UL << RS_styleShift)
337
339#define RS_styleCount 4 338#define RS_styleCount 4
339#define RS_styleShift 27
340#define RS_styleMask (RS_Bold | RS_Italic) 340#define RS_styleMask (RS_Bold | RS_Italic)
341#define RS_styleShift 27 341
342// fake styles
343#define RS_Blink (1UL << 29)
344#define RS_RVid (1UL << 30) // reverse video
345#define RS_Uline (1UL << 31) // underline
342 346
343#define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline) 347#define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline)
344#define RS_attrMask (RS_baseattrMask | RS_fontMask) 348#define RS_attrMask (RS_baseattrMask | RS_fontMask)
345 349
346#define DEFAULT_RSTYLE (RS_None | (Color_fg << RS_fgShift) | (Color_bg << RS_bgShift)) 350#define DEFAULT_RSTYLE (RS_None | (Color_fg << RS_fgShift) | (Color_bg << RS_bgShift))
637 641
638#define GET_STYLE(x) (((x) & RS_styleMask) >> RS_styleShift) 642#define GET_STYLE(x) (((x) & RS_styleMask) >> RS_styleShift)
639#define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift)) 643#define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift))
640 644
641#define GET_ATTR(x) (((x) & RS_attrMask)) 645#define GET_ATTR(x) (((x) & RS_attrMask))
646// return attributes defining the background, encoding doesn't matter
647// depends on RS_fgShift > RS_bgShift
642#define GET_BGATTR(x) \ 648#define GET_BGATTR(x) \
649 (expect_false ((x) & RS_RVid) \
643 (((x) & RS_RVid) ? (((x) & (RS_attrMask & ~RS_RVid)) \ 650 ? (((x) & (RS_attrMask & ~RS_RVid)) \
644 | (((x) & RS_colorMask) << RS_bgShift)) \ 651 | (((x) & RS_fgMask) >> (RS_fgShift - RS_bgShift))) \
645 : ((x) & (RS_attrMask | RS_bgMask))) 652 : ((x) & (RS_attrMask | RS_bgMask)))
646#define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift)) 653#define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift))
647#define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift)) 654#define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift))
648#define SET_ATTR(x,a) (((x) & ~RS_attrMask) | (a)) 655#define SET_ATTR(x,a) (((x) & ~RS_attrMask) | (a))
649 656
650#define RS_SAME(a,b) (!(((a) ^ (b)) & ~RS_Careful)) 657#define RS_SAME(a,b) (!(((a) ^ (b)) & ~RS_Careful))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines