Guest User

Untitled

a guest
Dec 16th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.28 KB | None | 0 0
  1. --- README.configure
  2. +++ README.configure
  3. @@ -9,8 +9,8 @@ CONFIGURE OPTIONS
  4.  
  5. --enable-everything
  6. Add (or remove) support for all non-multichoice options listed in
  7. - "./configure --help", except for "--enable-assert" and
  8. - "--enable-256-color".
  9. + "./configure --help", except for "--enable-assert",
  10. + "--enable-256-color" and "--enable-24-bit-color".
  11.  
  12. You can specify this and then disable options you do not like by
  13. *following* this with the appropriate "--disable-..." arguments, or
  14. @@ -251,6 +251,20 @@ CONFIGURE OPTIONS
  15. dramatically when more than six fonts are in use by a terminal
  16. instance.
  17.  
  18. + --enable-24-bit-color (default: off)
  19. + Enable use of 24-bit colors through
  20. + SGR 38 ; 2 ; R ; G ; B m
  21. + SGR 48 ; 2 ; R ; G ; B m
  22. +
  23. + This switch should break termcap/terminfo compatibility to
  24. + "TERM=rxvt-unicode-256color", and consequently set "TERM" to
  25. + "rxvt-unicode-24bit" by default but there is no termcap/terminfo
  26. + for 24-bit color support
  27. +
  28. + It also results in higher memory usage and can slow down urxvt
  29. + dramatically when more than six fonts are in use by a terminal
  30. + instance.
  31. +
  32. --with-name=NAME (default: urxvt)
  33. Set the basename for the installed binaries, resulting in "urxvt",
  34. "urxvtd" etc.). Specify "--with-name=rxvt" to replace with "rxvt".
  35. --- config.h.in
  36. +++ config.h.in
  37. @@ -380,6 +380,9 @@
  38. /* Define if you want 256-color support */
  39. #undef USE_256_COLORS
  40.  
  41. +/* Define if you want 24-bit color support */
  42. +#undef USE_24_BIT_COLOR
  43. +
  44. /* Enable extensions on AIX 3, Interix. */
  45. #ifndef _ALL_SOURCE
  46. # undef _ALL_SOURCE
  47. --- configure
  48. +++ configure
  49. @@ -713,6 +713,7 @@ enable_everything
  50. enable_assert
  51. enable_warnings
  52. enable_256_color
  53. +enable_24_bit_color
  54. enable_unicode3
  55. enable_combining
  56. enable_xft
  57. @@ -1386,6 +1387,7 @@ Optional Features:
  58. --enable-assert enable assertions
  59. --enable-warnings turn on g++ warnings
  60. --enable-256-color enable 256-color support
  61. + --enable-24-bit-color enable 24-bit color support
  62. --enable-unicode3 use 21 instead of 16 bits to represent unicode characters
  63. --enable-combining enable composition of base and combining characters
  64. --enable-xft enable xft support on systems that have it
  65. @@ -4820,6 +4822,20 @@ $as_echo "#define USE_256_COLORS 1" >>confdefs.h
  66.  
  67. fi
  68.  
  69. +support_24_bit_color=no
  70. +# Check whether --enable-24-bit-color was given.
  71. +if test "${enable_24_bit_color+set}" = set; then :
  72. + enableval=$enable_24_bit_color; if test x$enableval = xyes; then
  73. + support_24_bit_color=yes
  74. + fi
  75. +fi
  76. +
  77. +if test x$support_24_bit_color = xyes; then
  78. +
  79. +$as_echo "#define USE_24_BIT_COLOR 1" >>confdefs.h
  80. +
  81. +fi
  82. +
  83. # Check whether --enable-unicode3 was given.
  84. if test "${enable_unicode3+set}" = set; then :
  85. enableval=$enable_unicode3; if test x$enableval = xyes -o x$enableval = xno; then
  86. --- configure.ac
  87. +++ configure.ac
  88. @@ -201,6 +201,16 @@ if test x$support_256_color = xyes; then
  89. AC_DEFINE(USE_256_COLORS, 1, Define if you want 256-color support)
  90. fi
  91.  
  92. +support_24_bit_color=no
  93. +AC_ARG_ENABLE(24-bit-color,
  94. + [ --enable-24-bit-color enable 24-bit color support],
  95. + [if test x$enableval = xyes; then
  96. + support_24_bit_color=yes
  97. + fi])
  98. +if test x$support_24_bit_color = xyes; then
  99. + AC_DEFINE(USE_24_BIT_COLOR, 1, Define if you want 24-bit color support)
  100. +fi
  101. +
  102. AC_ARG_ENABLE(unicode3,
  103. [ --enable-unicode3 use 21 instead of 16 bits to represent unicode characters],
  104. [if test x$enableval = xyes -o x$enableval = xno; then
  105. --- src/background.C
  106. +++ src/background.C
  107. @@ -312,7 +312,7 @@ rxvt_term::render_image (rxvt_image &image)
  108. img->draw (bg_img, PictOpOver, image.alpha * 1. / 0xffff);
  109.  
  110. XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
  111. - img->convert_format (format, pix_colors [Color_bg])->replace (img);
  112. + img->convert_format (format, lookup_color(Color_bg, pix_colors))->replace (img);
  113.  
  114. delete bg_img;
  115. bg_img = img;
  116. @@ -471,7 +471,7 @@ rxvt_term::render_root_image ()
  117. }
  118.  
  119. XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
  120. - img->convert_format (format, pix_colors [Color_bg])->replace (img);
  121. + img->convert_format (format, lookup_color(Color_bg, pix_colors))->replace (img);
  122.  
  123. delete bg_img;
  124. bg_img = img;
  125. @@ -520,7 +520,7 @@ rxvt_term::bg_init ()
  126. root_effects.set_blur (rs [Rs_blurradius]);
  127.  
  128. if (ISSET_PIXCOLOR (Color_tint))
  129. - root_effects.set_tint (pix_colors_focused [Color_tint]);
  130. + root_effects.set_tint (lookup_color(Color_tint, pix_colors_focused));
  131.  
  132. if (rs [Rs_shade])
  133. root_effects.set_shade (rs [Rs_shade]);
  134. --- src/command.C
  135. +++ src/command.C
  136. @@ -1843,11 +1843,11 @@ rxvt_term::update_fade_color (unsigned int idx, bool first_time)
  137. if (rs[Rs_fade])
  138. {
  139. if (!first_time)
  140. - pix_colors_focused [idx].free (this);
  141. + lookup_color(idx, pix_colors_focused).free (this);
  142.  
  143. rgba c;
  144. - pix_colors [Color_fade].get (c);
  145. - pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
  146. + lookup_color(Color_fade, pix_colors).get (c);
  147. + lookup_color(idx, pix_colors_focused).fade (this, atoi (rs[Rs_fade]), lookup_color(idx, pix_colors_unfocused), c);
  148. }
  149. #endif
  150. }
  151. @@ -3334,7 +3334,7 @@ rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
  152. if (str[0] == '?' && !str[1])
  153. {
  154. rgba c;
  155. - pix_colors_focused[color].get (c);
  156. + lookup_color(color, pix_colors_focused).get (c);
  157.  
  158. #if XFT
  159. if (c.a != rgba::MAX_CC)
  160. @@ -3482,7 +3482,7 @@ rxvt_term::process_xterm_seq (int op, char *str, char resp)
  161. bool changed = false;
  162.  
  163. if (ISSET_PIXCOLOR (Color_tint))
  164. - changed = root_effects.set_tint (pix_colors_focused [Color_tint]);
  165. + changed = root_effects.set_tint (lookup_color(Color_tint, pix_colors_focused));
  166.  
  167. if (changed)
  168. update_background ();
  169. @@ -3876,7 +3876,7 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
  170. {
  171. unsigned int i;
  172. short rendset;
  173. - int rendstyle;
  174. + rend_t rendstyle;
  175.  
  176. if (nargs == 0)
  177. {
  178. @@ -3969,6 +3969,14 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
  179. scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg);
  180. i += 2;
  181. }
  182. +#if USE_24_BIT_COLOR
  183. + else if (nargs > i + 4 && arg[i + 1] == 2)
  184. + {
  185. + unsigned int r = arg[i + 2], g = arg[i + 3], b = arg[i + 4];
  186. + scr_color_rgb (r, g, b, Color_fg);
  187. + i += 4;
  188. + }
  189. +#endif
  190. break;
  191. case 39: /* default fg */
  192. scr_color (Color_fg, Color_fg);
  193. @@ -3990,6 +3998,14 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
  194. scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg);
  195. i += 2;
  196. }
  197. +#if USE_24_BIT_COLOR
  198. + else if (nargs > i + 4 && arg[i + 1] == 2)
  199. + {
  200. + unsigned int r = arg[i + 2], g = arg[i + 3], b = arg[i + 4];
  201. + scr_color_rgb (r, g, b, Color_bg);
  202. + i += 4;
  203. + }
  204. +#endif
  205. break;
  206. case 49: /* default bg */
  207. scr_color (Color_bg, Color_bg);
  208. --- src/init.C
  209. +++ src/init.C
  210. @@ -1068,7 +1068,7 @@ rxvt_term::get_colors ()
  211.  
  212. for (i = 0; i < NRS_COLORS; i++)
  213. if (const char *name = rs[Rs_color + i])
  214. - set_color (pix_colors [i], name);
  215. + set_color (lookup_color(i, pix_colors), name);
  216.  
  217. /*
  218. * get scrollBar shadow colors
  219. @@ -1077,13 +1077,13 @@ rxvt_term::get_colors ()
  220. * from the fvwm window manager.
  221. */
  222. #ifdef RXVT_SCROLLBAR
  223. - pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
  224. + lookup_color(Color_scroll, pix_colors).fade (this, 50, lookup_color(Color_bottomShadow, pix_colors));
  225.  
  226. rgba cscroll;
  227. - pix_colors [Color_scroll].get (cscroll);
  228. + lookup_color(Color_scroll, pix_colors).get (cscroll);
  229.  
  230. /* topShadowColor */
  231. - if (!pix_colors[Color_topShadow].set (this,
  232. + if (!lookup_color(Color_topShadow, pix_colors).set (this,
  233. rgba (
  234. min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5),
  235. min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5),
  236. @@ -1325,8 +1325,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
  237. window_calc (0, 0);
  238.  
  239. /* sub-window placement & size in rxvt_term::resize_all_windows () */
  240. - attributes.background_pixel = pix_colors_focused [Color_border];
  241. - attributes.border_pixel = pix_colors_focused [Color_border];
  242. + attributes.background_pixel = lookup_color(Color_border, pix_colors_focused);
  243. + attributes.border_pixel = lookup_color(Color_border, pix_colors_focused);
  244. attributes.colormap = cmap;
  245.  
  246. top = XCreateWindow (dpy, parent,
  247. @@ -1412,8 +1412,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
  248. window_vt_x, window_vt_y,
  249. vt_width, vt_height,
  250. 0,
  251. - pix_colors_focused[Color_fg],
  252. - pix_colors_focused[Color_bg]);
  253. + lookup_color(Color_fg, pix_colors_focused),
  254. + lookup_color(Color_bg, pix_colors_focused));
  255.  
  256. attributes.bit_gravity = NorthWestGravity;
  257. XChangeWindowAttributes (dpy, vt, CWBitGravity, &attributes);
  258. @@ -1430,8 +1430,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
  259. vt_ev.start (display, vt);
  260.  
  261. /* graphics context for the vt window */
  262. - gcvalue.foreground = pix_colors[Color_fg];
  263. - gcvalue.background = pix_colors[Color_bg];
  264. + gcvalue.foreground = lookup_color(Color_fg, pix_colors);
  265. + gcvalue.background = lookup_color(Color_bg, pix_colors);
  266. gcvalue.graphics_exposures = 0;
  267.  
  268. gc = XCreateGC (dpy, vt,
  269. --- src/main.C
  270. +++ src/main.C
  271. @@ -254,10 +254,10 @@ rxvt_term::~rxvt_term ()
  272. for (int i = 0; i < TOTAL_COLORS; i++)
  273. if (ISSET_PIXCOLOR (i))
  274. {
  275. - pix_colors_focused [i].free (this);
  276. + lookup_color(i, pix_colors_focused).free (this);
  277. #if OFF_FOCUS_FADING
  278. if (rs[Rs_fade])
  279. - pix_colors_unfocused [i].free (this);
  280. + lookup_color(i, pix_colors_unfocused).free (this);
  281. #endif
  282. }
  283.  
  284. @@ -971,8 +971,8 @@ rxvt_term::set_window_color (int idx, const char *color)
  285. }
  286. }
  287.  
  288. - pix_colors_focused[idx].free (this);
  289. - set_color (pix_colors_focused[idx], color);
  290. + lookup_color(idx, pix_colors_focused).free (this);
  291. + set_color (lookup_color(idx, pix_colors_focused), color);
  292.  
  293. done:
  294. /*TODO: handle Color_BD, scrollbar background, etc. */
  295. @@ -989,12 +989,12 @@ rxvt_term::recolor_cursor ()
  296. XColor fg, bg;
  297.  
  298. (ISSET_PIXCOLOR (Color_pointer_fg)
  299. - ? pix_colors_focused[Color_pointer_fg]
  300. - : pix_colors_focused[Color_fg]).get (fg);
  301. + ? lookup_color(Color_pointer_fg, pix_colors_focused)
  302. + : lookup_color(Color_fg, pix_colors_focused)).get (fg);
  303.  
  304. (ISSET_PIXCOLOR (Color_pointer_bg)
  305. - ? pix_colors_focused[Color_pointer_bg]
  306. - : pix_colors_focused[Color_bg]).get (bg);
  307. + ? lookup_color(Color_pointer_bg, pix_colors_focused)
  308. + : lookup_color(Color_bg, pix_colors_focused)).get (bg);
  309.  
  310. XRecolorCursor (dpy, TermWin_cursor, &fg, &bg);
  311. }
  312. @@ -1013,14 +1013,14 @@ rxvt_term::get_colorfgbg ()
  313. char *env_colorfgbg;
  314.  
  315. for (i = Color_Black; i <= Color_White; i++)
  316. - if (pix_colors[Color_fg] == pix_colors[i])
  317. + if (lookup_color(Color_fg, pix_colors) == lookup_color(i, pix_colors))
  318. {
  319. sprintf (fstr, "%d", i - Color_Black);
  320. break;
  321. }
  322.  
  323. for (i = Color_Black; i <= Color_White; i++)
  324. - if (pix_colors[Color_bg] == pix_colors[i])
  325. + if (lookup_color(Color_bg, pix_colors) == lookup_color(i, pix_colors))
  326. {
  327. sprintf (bstr, "%d", i - Color_Black);
  328. #if BG_IMAGE_FROM_FILE
  329. @@ -1049,8 +1049,8 @@ rxvt_term::set_color (rxvt_color &color, const char *name)
  330. void
  331. rxvt_term::alias_color (int dst, int src)
  332. {
  333. - pix_colors[dst].free (this);
  334. - pix_colors[dst].set (this, rs[Rs_color + dst] = rs[Rs_color + src]);
  335. + lookup_color(dst, pix_colors).free (this);
  336. + lookup_color(dst, pix_colors).set (this, rs[Rs_color + dst] = rs[Rs_color + src]);
  337. }
  338.  
  339. /* -------------------------------------------------------------------- *
  340. @@ -1188,8 +1188,8 @@ rxvt_term::set_widthheight (unsigned int newwidth, unsigned int newheight)
  341. void
  342. rxvt_term::im_set_color (unsigned long &fg, unsigned long &bg)
  343. {
  344. - fg = pix_colors [Color_fg];
  345. - bg = pix_colors [Color_bg];
  346. + fg = lookup_color(Color_fg, pix_colors);
  347. + bg = lookup_color(Color_bg, pix_colors);
  348. }
  349.  
  350. void
  351. --- src/rxvt.h
  352. +++ src/rxvt.h
  353. @@ -39,7 +39,11 @@ typedef uint32_t text_t;
  354. #else
  355. typedef uint16_t text_t; // saves lots of memory
  356. #endif
  357. +#if USE_24_BIT_COLOR
  358. +typedef uint64_t rend_t;
  359. +#else
  360. typedef uint32_t rend_t;
  361. +#endif
  362. typedef int32_t tlen_t; // was int16_t, but this results in smaller code and memory use
  363. typedef int32_t tlen_t_; // specifically for use in the line_t structure
  364.  
  365. @@ -411,43 +415,52 @@ enum {
  366. #define RS_None 0
  367.  
  368. // GET_BGATTR depends on RS_fgShift > RS_bgShift
  369. -#define RS_colorMask ((1UL << Color_Bits) - 1UL)
  370. -#define RS_bgShift 0
  371. -#define RS_fgShift (RS_bgShift + Color_Bits)
  372. -#define RS_bgMask (RS_colorMask << RS_bgShift)
  373. -#define RS_fgMask (RS_colorMask << RS_fgShift)
  374. +#define RS_colorMask ((rend_t) ((1UL << Color_Bits) - 1UL))
  375. +#define RS_bgShift 0
  376. +#define RS_fgShift (RS_bgShift + Color_Bits)
  377. +#define RS_bgMask ((rend_t) (RS_colorMask << RS_bgShift))
  378. +#define RS_fgMask ((rend_t) (RS_colorMask << RS_fgShift))
  379.  
  380. // must have space for rxvt_fontset::fontCount * 2 + 2 values
  381. #define RS_fontShift (RS_fgShift + Color_Bits)
  382. -#define RS_Careful (1UL << RS_fontShift) /* be careful when drawing these */
  383. -#define RS_fontCount rxvt_fontset::fontCount
  384. -#define RS_fontMask ((RS_fontCount << (RS_fontShift + 1)) | RS_Careful) // includes RS_Careful
  385. +#define RS_Careful ((rend_t) (1UL << RS_fontShift)) /* be careful when drawing these */
  386. +#define RS_fontCount ((rend_t) rxvt_fontset::fontCount)
  387. +#define RS_fontMask ((rend_t) ((RS_fontCount << (RS_fontShift + 1)) | RS_Careful)) // includes RS_Careful
  388.  
  389. // toggle this to force redraw, must be != RS_Careful and otherwise "pretty neutral"
  390. -#define RS_redraw (2UL << RS_fontShift)
  391. +#define RS_redraw ((rend_t) (2UL << RS_fontShift))
  392.  
  393. -#define RS_Sel (1UL << 22)
  394. +#if USE_24_BIT_COLOR
  395. +# define RS_fontCountSize 4
  396. +#elif USE_256_COLORS
  397. +# define RS_fontCountSize 4
  398. +#else
  399. +# define RS_fontCountSize 8
  400. +#endif
  401. +
  402. +#define RS_selShift (RS_fontShift + RS_fontCountSize)
  403. +#define RS_Sel ((rend_t) (1UL << RS_selShift))
  404.  
  405. // 4 custom bits for extensions
  406. #define RS_customCount 16UL
  407. -#define RS_customShift 23
  408. -#define RS_customMask ((RS_customCount - 1UL) << RS_customShift)
  409. +#define RS_customShift (RS_selShift + 1)
  410. +#define RS_customMask ((rend_t) ((RS_customCount - 1UL) << RS_customShift))
  411.  
  412. // font styles
  413. -#define RS_Bold (1UL << RS_styleShift)
  414. -#define RS_Italic (2UL << RS_styleShift)
  415. +#define RS_Bold ((rend_t) (1UL << RS_styleShift))
  416. +#define RS_Italic ((rend_t) (2UL << RS_styleShift))
  417.  
  418. -#define RS_styleCount 4
  419. -#define RS_styleShift 27
  420. -#define RS_styleMask (RS_Bold | RS_Italic)
  421. +#define RS_styleCount 4
  422. +#define RS_styleShift (RS_customShift + RS_styleCount)
  423. +#define RS_styleMask ((rend_t) (RS_Bold | RS_Italic))
  424.  
  425. // fake styles
  426. -#define RS_Blink (1UL << 29)
  427. -#define RS_RVid (1UL << 30) // reverse video
  428. -#define RS_Uline (1UL << 31) // underline
  429. +#define RS_Blink ((rend_t) (1UL << (RS_styleShift + 2)))
  430. +#define RS_RVid ((rend_t) (1UL << (RS_styleShift + 3))) // reverse video
  431. +#define RS_Uline ((rend_t) (1UL << (RS_styleShift + 4))) // underline
  432.  
  433. -#define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline)
  434. -#define RS_attrMask (RS_baseattrMask | RS_fontMask)
  435. +#define RS_baseattrMask ((rend_t) (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline))
  436. +#define RS_attrMask ((rend_t) (RS_baseattrMask | RS_fontMask))
  437.  
  438. #define DEFAULT_RSTYLE (RS_None | (Color_fg << RS_fgShift) | (Color_bg << RS_bgShift))
  439. #define OVERLAY_RSTYLE (RS_None | (Color_Black << RS_fgShift) | (Color_Yellow << RS_bgShift))
  440. @@ -599,7 +612,9 @@ enum colour_list {
  441. #endif
  442. };
  443.  
  444. -#if USE_256_COLORS
  445. +#if USE_24_BIT_COLOR
  446. +#define Color_Bits 25
  447. +#elif USE_256_COLORS
  448. # define Color_Bits 9 // 0 .. maxTermCOLOR
  449. #else
  450. # define Color_Bits 7 // 0 .. maxTermCOLOR
  451. @@ -729,21 +744,21 @@ typedef struct _mwmhints
  452. #define ROW(n) ROW_of (this, n)
  453.  
  454. /* how to build & extract colors and attributes */
  455. -#define GET_BASEFG(x) (((x) & RS_fgMask) >> RS_fgShift)
  456. -#define GET_BASEBG(x) (((x) & RS_bgMask) >> RS_bgShift)
  457. +#define GET_BASEFG(x) ((((rend_t) (x)) & RS_fgMask) >> RS_fgShift)
  458. +#define GET_BASEBG(x) ((((rend_t) (x)) & RS_bgMask) >> RS_bgShift)
  459.  
  460. -#define GET_FONT(x) (((x) & RS_fontMask) >> RS_fontShift)
  461. -#define SET_FONT(x,fid) (((x) & ~RS_fontMask) | ((fid) << RS_fontShift))
  462. +#define GET_FONT(x) ((((rend_t) (x)) & RS_fontMask) >> RS_fontShift)
  463. +#define SET_FONT(x,fid) ((((rend_t) (x)) & ~((rend_t) RS_fontMask)) | (((rend_t) (fid)) << RS_fontShift))
  464.  
  465. -#define GET_STYLE(x) (((x) & RS_styleMask) >> RS_styleShift)
  466. -#define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift))
  467. +#define GET_STYLE(x) ((((rend_t) (x)) & RS_styleMask) >> RS_styleShift)
  468. +#define SET_STYLE(x,style) ((((rend_t) (x)) & ~((rend_t) RS_styleMask)) | (((rend_t) (style)) << RS_styleShift))
  469.  
  470. -#define GET_ATTR(x) (((x) & RS_attrMask))
  471. -#define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift))
  472. -#define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift))
  473. -#define SET_ATTR(x,a) (((x) & ~RS_attrMask) | (a))
  474. +#define GET_ATTR(x) ((((rend_t) (x)) & RS_attrMask))
  475. +#define SET_FGCOLOR(x,fg) ((((rend_t) (x)) & ~((rend_t) RS_fgMask)) | (((rend_t) (fg)) << RS_fgShift))
  476. +#define SET_BGCOLOR(x,bg) ((((rend_t) (x)) & ~((rend_t) RS_bgMask)) | (((rend_t) (bg)) << RS_bgShift))
  477. +#define SET_ATTR(x,a) ((((rend_t) (x)) & ~((rend_t) RS_attrMask)) | ((rend_t) (a)))
  478.  
  479. -#define RS_SAME(a,b) (!(((a) ^ (b)) & ~RS_Careful))
  480. +#define RS_SAME(a,b) (!((((rend_t) (a)) ^ ((rend_t) (b))) & ~((rend_t) RS_Careful)))
  481.  
  482. #define PIXCOLOR_NAME(idx) rs[Rs_color + (idx)]
  483. #define ISSET_PIXCOLOR(idx) (!!rs[Rs_color + (idx)])
  484. @@ -1503,7 +1518,12 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
  485. void scr_swap_screen () NOTHROW;
  486. void scr_change_screen (int scrn);
  487. void scr_color (unsigned int color, int fgbg) NOTHROW;
  488. - void scr_rendition (int set, int style) NOTHROW;
  489. +#if USE_24_BIT_COLOR
  490. + void scr_color_24 (unsigned int color, int fgbg) NOTHROW;
  491. + void scr_color_rgb (unsigned int r, unsigned int g, unsigned int b, int fgbg) NOTHROW;
  492. +#endif
  493. + rxvt_color &lookup_color (unsigned int color, rxvt_color *table) NOTHROW;
  494. + void scr_rendition (int set, rend_t style) NOTHROW;
  495. void scr_add_lines (const wchar_t *str, int len, int minlines = 0) NOTHROW;
  496. void scr_backspace () NOTHROW;
  497. void scr_tab (int count, bool ht = false) NOTHROW;
  498. --- src/rxvtfont.C
  499. +++ src/rxvtfont.C
  500. @@ -243,20 +243,20 @@ rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color)
  501.  
  502. # ifdef HAVE_BG_PIXMAP
  503. if (term->bg_img
  504. - && !term->pix_colors[color].is_opaque ()
  505. + && !term->lookup_color(color, term->pix_colors).is_opaque ()
  506. && ((dst = XftDrawPicture (d))))
  507. {
  508. XClearArea (disp, d, x, y, w, h, false);
  509.  
  510. - Picture solid_color_pict = XftDrawSrcPicture (d, &term->pix_colors[color].c);
  511. + Picture solid_color_pict = XftDrawSrcPicture (d, &term->lookup_color(color, term->pix_colors).c);
  512. XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, x, y, w, h);
  513. }
  514. else
  515. # endif
  516. - XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h);
  517. + XftDrawRect (d, &term->lookup_color(color, term->pix_colors).c, x, y, w, h);
  518.  
  519. #else
  520. - XSetForeground (disp, gc, term->pix_colors[color]);
  521. + XSetForeground (disp, gc, term->lookup_color(color, term->pix_colors));
  522. XFillRectangle (disp, d, gc, x, y, w, h);
  523. #endif
  524. }
  525. @@ -342,7 +342,7 @@ rxvt_font_default::draw (rxvt_drawable &d, int x, int y,
  526.  
  527. clear_rect (d, x, y, term->fwidth * len, term->fheight, bg);
  528.  
  529. - XSetForeground (disp, gc, term->pix_colors[fg]);
  530. + XSetForeground (disp, gc, term->lookup_color(fg, term->pix_colors));
  531.  
  532. while (len)
  533. {
  534. @@ -1053,7 +1053,7 @@ rxvt_font_x11::draw (rxvt_drawable &d, int x, int y,
  535. int base = ascent; // sorry, incorrect: term->fbase;
  536.  
  537. XGCValues v;
  538. - v.foreground = term->pix_colors[fg];
  539. + v.foreground = term->lookup_color(fg, term->pix_colors);
  540. v.font = f->fid;
  541.  
  542. if (enc2b)
  543. @@ -1062,7 +1062,7 @@ rxvt_font_x11::draw (rxvt_drawable &d, int x, int y,
  544.  
  545. if (bg == Color_bg && !slow)
  546. {
  547. - v.background = term->pix_colors[bg];
  548. + v.background = term->lookup_color(bg, term->pix_colors);
  549. XChangeGC (disp, gc, GCForeground | GCBackground | GCFont, &v);
  550. XDrawImageString16 (disp, d, gc, x, y + base, xc, len);
  551. }
  552. @@ -1094,7 +1094,7 @@ rxvt_font_x11::draw (rxvt_drawable &d, int x, int y,
  553.  
  554. if (bg == Color_bg && !slow)
  555. {
  556. - v.background = term->pix_colors[bg];
  557. + v.background = term->lookup_color(bg, term->pix_colors);
  558. XChangeGC (disp, gc, GCForeground | GCBackground | GCFont, &v);
  559. XDrawImageString (disp, d, gc, x, y + base, xc, len);
  560. }
  561. @@ -1417,7 +1417,7 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
  562.  
  563. if (term->bg_img
  564. && (bg == Color_transparent || bg == Color_bg
  565. - || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2))))))
  566. + || (bg >= 0 && !term->lookup_color(bg, term->pix_colors).is_opaque () && ((dst = XftDrawPicture (d2))))))
  567. {
  568. int src_x = x, src_y = y;
  569.  
  570. @@ -1454,7 +1454,7 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
  571.  
  572. if (dst)
  573. {
  574. - Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c);
  575. + Picture solid_color_pict = XftDrawSrcPicture (d2, &term->lookup_color(bg, term->pix_colors).c);
  576.  
  577. // dst can only be set when bg >= 0
  578. XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h);
  579. @@ -1462,9 +1462,9 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
  580. }
  581. else
  582. #endif
  583. - XftDrawRect (d2, &term->pix_colors[bg >= 0 ? bg : Color_bg].c, 0, 0, w, h);
  584. + XftDrawRect (d2, &term->lookup_color(bg >= 0 ? bg : Color_bg, term->pix_colors).c, 0, 0, w, h);
  585.  
  586. - XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc);
  587. + XftDrawGlyphSpec (d2, &term->lookup_color(fg, term->pix_colors).c, f, enc, ep - enc);
  588. XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y);
  589. }
  590. else
  591. @@ -1473,7 +1473,7 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
  592. else
  593. {
  594. clear_rect (d, x, y, w, h, bg);
  595. - XftDrawGlyphSpec (d, &term->pix_colors[fg].c, f, enc, ep - enc);
  596. + XftDrawGlyphSpec (d, &term->lookup_color(fg, term->pix_colors).c, f, enc, ep - enc);
  597. }
  598. }
  599.  
  600. --- src/rxvtfont.h
  601. +++ src/rxvtfont.h
  602. @@ -72,8 +72,10 @@ struct rxvt_fontset
  603. char *fontdesc;
  604.  
  605. // must be power-of-two - 1, also has to match RS_fontMask in rxvt.h
  606. -#if USE_256_COLORS
  607. - enum { fontCount = 7 }; // 4 extra colors bits, 4 fewer fontcount bits
  608. +#if USE_24_BIT_COLOR
  609. + enum { fontCount = 7 }; // 36 extra colors bits, 4 fewer fontcount bits
  610. +#elif USE_256_COLORS
  611. + enum { fontCount = 7 }; // 4 extra colors bits, 4 fewer fontcount bits
  612. #else
  613. enum { fontCount = 127 };
  614. #endif
  615. --- src/rxvtperl.xs
  616. +++ src/rxvtperl.xs
  617. @@ -789,6 +789,18 @@ MODULE = urxvt PACKAGE = urxvt
  618.  
  619. PROTOTYPES: ENABLE
  620.  
  621. +TYPEMAP: <<END
  622. +rend_t T_UINT
  623. +
  624. +INPUT
  625. +T_UINT
  626. + $var = ($type)SvUV($arg);
  627. +
  628. +OUTPUT
  629. +T_UINT
  630. + sv_setuv($arg, (UV)$var);
  631. +END
  632. +
  633. BOOT:
  634. {
  635. sv_setsv (get_sv ("urxvt::LIBDIR", 1), newSVpvn (LIBDIR, sizeof (LIBDIR) - 1));
  636. @@ -1069,43 +1081,44 @@ NOW ()
  637. OUTPUT:
  638. RETVAL
  639.  
  640. -int
  641. -GET_BASEFG (int rend)
  642. +rend_t
  643. +GET_BASEFG (rend_t rend)
  644. CODE:
  645. RETVAL = GET_BASEFG (rend);
  646. OUTPUT:
  647. RETVAL
  648.  
  649. -int
  650. -GET_BASEBG (int rend)
  651. +rend_t
  652. +GET_BASEBG (rend_t rend)
  653. CODE:
  654. RETVAL = GET_BASEBG (rend);
  655. OUTPUT:
  656. RETVAL
  657.  
  658. -int
  659. -SET_FGCOLOR (int rend, int new_color)
  660. +rend_t
  661. +SET_FGCOLOR (rend_t rend, int new_color)
  662. CODE:
  663. RETVAL = SET_FGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1));
  664. OUTPUT:
  665. RETVAL
  666.  
  667. -int
  668. -SET_BGCOLOR (int rend, int new_color)
  669. +rend_t
  670. +SET_BGCOLOR (rend_t rend, int new_color)
  671. CODE:
  672. RETVAL = SET_BGCOLOR (rend, clamp (new_color, 0, TOTAL_COLORS - 1));
  673. OUTPUT:
  674. RETVAL
  675.  
  676. -int
  677. -GET_CUSTOM (int rend)
  678. +rend_t
  679. +GET_CUSTOM (rend_t rend)
  680. CODE:
  681. +
  682. RETVAL = (rend & RS_customMask) >> RS_customShift;
  683. OUTPUT:
  684. RETVAL
  685.  
  686. -int
  687. -SET_CUSTOM (int rend, int new_value)
  688. +rend_t
  689. +SET_CUSTOM (rend_t rend, int new_value)
  690. CODE:
  691. {
  692. if (!IN_RANGE_EXC (new_value, 0, RS_customCount))
  693. @@ -1515,8 +1528,8 @@ rxvt_term::vt_emask_add (U32 emask)
  694. THIS->vt_emask_perl |= emask;
  695. THIS->vt_select_input ();
  696.  
  697. -U32
  698. -rxvt_term::rstyle (U32 new_rstyle = THIS->rstyle)
  699. +UV
  700. +rxvt_term::rstyle (rend_t new_rstyle = THIS->rstyle)
  701. CODE:
  702. RETVAL = THIS->rstyle;
  703. THIS->rstyle = new_rstyle;
  704. @@ -2003,10 +2016,10 @@ rxvt_term::cur_charset ()
  705. RETVAL
  706.  
  707. void
  708. -rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle1 = RS_RVid, U32 rstyle2 = RS_RVid | RS_Uline)
  709. +rxvt_term::scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1 = RS_RVid, rend_t rstyle2 = RS_RVid | RS_Uline)
  710.  
  711. void
  712. -rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, U32 rstyle = RS_RVid)
  713. +rxvt_term::scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle = RS_RVid)
  714.  
  715. void
  716. rxvt_term::scr_bell ()
  717. @@ -2072,7 +2085,7 @@ rxvt_term::cmd_parse (SV *octets)
  718. }
  719.  
  720. SV *
  721. -rxvt_term::overlay (int x, int y, int w, int h, int rstyle = OVERLAY_RSTYLE, int border = 2)
  722. +rxvt_term::overlay (int x, int y, int w, int h, rend_t rstyle = OVERLAY_RSTYLE, int border = 2)
  723. CODE:
  724. {
  725. overlay *o = new overlay (THIS, x, y, w, h, rstyle, border);
  726. @@ -2171,8 +2184,8 @@ Window
  727. XCreateSimpleWindow (rxvt_term *term, Window parent, int x, int y, unsigned int width, unsigned int height)
  728. C_ARGS: term->dpy, (Window)parent,
  729. x, y, width, height, 0,
  730. - term->pix_colors_focused[Color_border],
  731. - term->pix_colors_focused[Color_border]
  732. + term->lookup_color(Color_border, term->pix_colors_focused),
  733. + term->lookup_color(Color_border, term->pix_colors_focused)
  734.  
  735. #endif
  736.  
  737. @@ -2299,7 +2312,7 @@ rxvt_term::set_background (rxvt_img *img, bool border = false)
  738. img->reify ()
  739. ->replace (img);
  740.  
  741. - img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->pix_colors [Color_bg])
  742. + img->convert_format (XRenderFindVisualFormat (THIS->dpy, THIS->visual), THIS->lookup_color(Color_bg, THIS->pix_colors))
  743. ->replace (img);
  744.  
  745. THIS->bg_img = img;
  746. --- src/screen.C
  747. +++ src/screen.C
  748. @@ -625,12 +625,52 @@ rxvt_term::scr_color (unsigned int color, int fgbg) NOTHROW
  749. rstyle = SET_BGCOLOR (rstyle, color);
  750. }
  751.  
  752. +#if USE_24_BIT_COLOR
  753. +static rxvt_color *scr_colors[1 << 24];
  754. +
  755. +void
  756. +rxvt_term::scr_color_24 (unsigned int color, int fgbg) NOTHROW
  757. +{
  758. + color += TOTAL_COLORS;
  759. + if (fgbg == Color_fg)
  760. + rstyle = SET_FGCOLOR (rstyle, color);
  761. + else
  762. + rstyle = SET_BGCOLOR (rstyle, color);
  763. +}
  764. +
  765. +void
  766. +rxvt_term::scr_color_rgb (unsigned int r, unsigned int g, unsigned int b, int fgbg) NOTHROW
  767. +{
  768. + unsigned int color = (r << 16) + (g << 8) + b;
  769. + scr_color_24(color, fgbg);
  770. +}
  771. +#endif
  772. +
  773. +rxvt_color
  774. +&rxvt_term::lookup_color (unsigned int color, rxvt_color *table) NOTHROW
  775. +{
  776. +#if USE_24_BIT_COLOR
  777. + if (color >= TOTAL_COLORS) {
  778. + color -= TOTAL_COLORS;
  779. + if (scr_colors[color] == NULL) {
  780. + scr_colors[color] = new rxvt_color();
  781. + char name[1+2*3+1];
  782. + sprintf(name, "#%02x%02x%02x", (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
  783. + scr_colors[color]->set(this, name);
  784. + }
  785. + return *scr_colors[color];
  786. + } else
  787. +#endif
  788. + return table[color];
  789. +}
  790. +
  791. +
  792. /* ------------------------------------------------------------------------- */
  793. /*
  794. * Change the rendition style for following text
  795. */
  796. void
  797. -rxvt_term::scr_rendition (int set, int style) NOTHROW
  798. +rxvt_term::scr_rendition (int set, rend_t style) NOTHROW
  799. {
  800. if (set)
  801. rstyle |= style;
  802. @@ -1388,13 +1428,13 @@ rxvt_term::scr_erase_screen (int mode) NOTHROW
  803.  
  804. if (mapped)
  805. {
  806. - gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
  807. + gcvalue.foreground = lookup_color(bgcolor_of (rstyle), pix_colors);
  808. XChangeGC (dpy, gc, GCForeground, &gcvalue);
  809. XFillRectangle (dpy, vt, gc,
  810. 0, Row2Pixel (row - view_start),
  811. (unsigned int)vt_width,
  812. (unsigned int)Height2Pixel (num));
  813. - gcvalue.foreground = pix_colors[Color_fg];
  814. + gcvalue.foreground = lookup_color(Color_fg, pix_colors);
  815. XChangeGC (dpy, gc, GCForeground, &gcvalue);
  816. }
  817. }
  818. @@ -1715,15 +1755,15 @@ rxvt_term::scr_rvideo_mode (bool on) NOTHROW
  819. {
  820. rvideo_state = on;
  821.  
  822. - ::swap (pix_colors[Color_fg], pix_colors[Color_bg]);
  823. + ::swap (lookup_color(Color_fg, pix_colors), lookup_color(Color_bg, pix_colors));
  824. #ifdef HAVE_IMG
  825. if (bg_img == 0)
  826. #endif
  827. - XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
  828. + XSetWindowBackground (dpy, vt, lookup_color(Color_bg, pix_colors));
  829.  
  830. XGCValues gcvalue;
  831. - gcvalue.foreground = pix_colors[Color_fg];
  832. - gcvalue.background = pix_colors[Color_bg];
  833. + gcvalue.foreground = lookup_color(Color_fg, pix_colors);
  834. + gcvalue.background = lookup_color(Color_bg, pix_colors);
  835. XChangeGC (dpy, gc, GCBackground | GCForeground, &gcvalue);
  836.  
  837. scr_clear ();
  838. @@ -2426,14 +2466,14 @@ rxvt_term::scr_refresh () NOTHROW
  839. {
  840. if (showcursor && focus && row == screen.cur.row
  841. && IN_RANGE_EXC (col, cur_col, cur_col + cursorwidth))
  842. - XSetForeground (dpy, gc, pix_colors[ccol1]);
  843. + XSetForeground (dpy, gc, lookup_color(ccol1, pix_colors));
  844. else
  845. #if ENABLE_FRILLS
  846. if (ISSET_PIXCOLOR (Color_underline))
  847. - XSetForeground (dpy, gc, pix_colors[Color_underline]);
  848. + XSetForeground (dpy, gc, lookup_color(Color_underline, pix_colors));
  849. else
  850. #endif
  851. - XSetForeground (dpy, gc, pix_colors[fore]);
  852. + XSetForeground (dpy, gc, lookup_color(fore, pix_colors));
  853.  
  854. XDrawLine (dpy, vt, gc,
  855. xpixel, ypixel + font->ascent + 1,
  856. @@ -2453,7 +2493,7 @@ rxvt_term::scr_refresh () NOTHROW
  857. scr_set_char_rend (ROW(screen.cur.row), cur_col, cur_rend);
  858. else if (oldcursor.row >= 0)
  859. {
  860. - XSetForeground (dpy, gc, pix_colors[ccol1]);
  861. + XSetForeground (dpy, gc, lookup_color(ccol1, pix_colors));
  862. if (cursor_type == 1)
  863. XFillRectangle (dpy, vt, gc,
  864. Col2Pixel (cur_col),
  865. @@ -2463,7 +2503,7 @@ rxvt_term::scr_refresh () NOTHROW
  866. }
  867. else if (oldcursor.row >= 0)
  868. {
  869. - XSetForeground (dpy, gc, pix_colors[ccol1]);
  870. + XSetForeground (dpy, gc, lookup_color(ccol1, pix_colors));
  871.  
  872. XDrawRectangle (dpy, vt, gc,
  873. Col2Pixel (cur_col),
  874. @@ -2532,15 +2572,15 @@ rxvt_term::scr_recolor (bool refresh) NOTHROW
  875. else
  876. # endif
  877. {
  878. - XSetWindowBackground (dpy, parent, pix_colors[Color_border]);
  879. + XSetWindowBackground (dpy, parent, lookup_color(Color_border, pix_colors));
  880. XSetWindowBackgroundPixmap (dpy, vt, bg_img->pm);
  881. }
  882. }
  883. else
  884. #endif
  885. {
  886. - XSetWindowBackground (dpy, parent, pix_colors[Color_border]);
  887. - XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
  888. + XSetWindowBackground (dpy, parent, lookup_color(Color_border, pix_colors));
  889. + XSetWindowBackground (dpy, vt, lookup_color(Color_bg, pix_colors));
  890. }
  891.  
  892. XClearWindow (dpy, parent);
  893. @@ -2550,7 +2590,7 @@ rxvt_term::scr_recolor (bool refresh) NOTHROW
  894. if (transparent)
  895. XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative);
  896. else
  897. - XSetWindowBackground (dpy, scrollBar.win, pix_colors[scrollBar.color ()]);
  898. + XSetWindowBackground (dpy, scrollBar.win, lookup_color(scrollBar.color (), pix_colors));
  899. scrollBar.state = SB_STATE_IDLE;
  900. scrollBar.show (0);
  901. }
  902. --- src/scrollbar-next.C
  903. +++ src/scrollbar-next.C
  904. @@ -154,15 +154,15 @@ scrollBar_t::init_next ()
  905.  
  906. gcvalue.graphics_exposures = False;
  907.  
  908. - gcvalue.foreground = term->pix_colors_focused[Color_Black];
  909. + gcvalue.foreground = term->lookup_color(Color_Black, term->pix_colors_focused);
  910. blackGC = XCreateGC (term->dpy, win,
  911. GCForeground | GCGraphicsExposures, &gcvalue);
  912.  
  913. - gcvalue.foreground = term->pix_colors_focused[Color_White];
  914. + gcvalue.foreground = term->lookup_color(Color_White, term->pix_colors_focused);
  915. whiteGC = XCreateGC (term->dpy, win,
  916. GCForeground | GCGraphicsExposures, &gcvalue);
  917.  
  918. - light = term->pix_colors_focused[Color_scroll];
  919. + light = term->lookup_color(Color_scroll, term->pix_colors_focused);
  920. #if 0
  921. //color used by rxvt
  922. if (color.set (term, rgba (0xaeba, 0xaaaa, 0xaeba)))
  923. @@ -172,7 +172,7 @@ scrollBar_t::init_next ()
  924. grayGC = XCreateGC (term->dpy, win,
  925. GCForeground | GCGraphicsExposures, &gcvalue);
  926.  
  927. - dark = term->pix_colors_focused[Color_Grey25];
  928. + dark = term->lookup_color(Color_Grey25, term->pix_colors_focused);
  929. #if 0
  930. //color used by rxvt
  931. if (color.set (term, rgba (0x51aa, 0x5555, 0x5144)))
  932. --- src/scrollbar-plain.C
  933. +++ src/scrollbar-plain.C
  934. @@ -38,7 +38,7 @@ scrollBar_t::show_plain (int update)
  935. XGCValues gcvalue;
  936.  
  937. init |= SB_STYLE_PLAIN;
  938. - gcvalue.foreground = term->pix_colors_focused[Color_scroll];
  939. + gcvalue.foreground = term->lookup_color(Color_scroll, term->pix_colors_focused);
  940.  
  941. pscrollbarGC = XCreateGC (term->dpy, win, GCForeground, &gcvalue);
  942. }
  943. --- src/scrollbar-rxvt.C
  944. +++ src/scrollbar-rxvt.C
  945. @@ -158,11 +158,11 @@ scrollBar_t::show_rxvt (int update)
  946.  
  947. init |= SB_STYLE_RXVT;
  948.  
  949. - gcvalue.foreground = term->pix_colors[Color_topShadow];
  950. + gcvalue.foreground = term->lookup_color(Color_topShadow, term->pix_colors);
  951. topShadowGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue);
  952. - gcvalue.foreground = term->pix_colors[Color_bottomShadow];
  953. + gcvalue.foreground = term->lookup_color(Color_bottomShadow, term->pix_colors);
  954. botShadowGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue);
  955. - gcvalue.foreground = term->pix_colors[ (term->depth <= 2 ? Color_fg : Color_scroll)];
  956. + gcvalue.foreground = term->lookup_color( (term->depth <= 2 ? Color_fg : Color_scroll), term->pix_colors);
  957. scrollbarGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue);
  958. }
  959. else
  960. --- src/scrollbar-xterm.C
  961. +++ src/scrollbar-xterm.C
  962. @@ -49,13 +49,13 @@ scrollBar_t::show_xterm (int update)
  963. rxvt_fatal ("can't create bitmap\n");
  964.  
  965. gcvalue.fill_style = FillOpaqueStippled;
  966. - gcvalue.foreground = term->pix_colors_focused[Color_scroll];
  967. - gcvalue.background = term->pix_colors_focused[Color_bg];
  968. + gcvalue.foreground = term->lookup_color(Color_scroll, term->pix_colors_focused);
  969. + gcvalue.background = term->lookup_color(Color_bg, term->pix_colors_focused);
  970.  
  971. xscrollbarGC = XCreateGC (term->dpy, win,
  972. GCForeground | GCBackground
  973. | GCFillStyle | GCStipple, &gcvalue);
  974. - gcvalue.foreground = term->pix_colors_focused[Color_border];
  975. + gcvalue.foreground = term->lookup_color(Color_border, term->pix_colors_focused);
  976. ShadowGC = XCreateGC (term->dpy, win, GCForeground, &gcvalue);
  977. }
  978.  
  979. --- src/scrollbar.C
  980. +++ src/scrollbar.C
  981. @@ -72,8 +72,8 @@ scrollBar_t::resize ()
  982. total_width (),
  983. term->szHint.height,
  984. 0,
  985. - term->pix_colors[Color_fg],
  986. - term->pix_colors[color ()]);
  987. + term->lookup_color(Color_fg, term->pix_colors),
  988. + term->lookup_color(color (), term->pix_colors));
  989. XDefineCursor (term->dpy, win, leftptr_cursor);
  990.  
  991. XSelectInput (term->dpy, win,
Add Comment
Please, Sign In to add comment