--- rxvt-unicode/src/init.C 2006/01/30 19:46:13 1.160 +++ rxvt-unicode/src/init.C 2006/01/31 19:54:39 1.167 @@ -299,9 +299,10 @@ if (!(display = displays.get (rs[Rs_display_name]))) rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); + // using a local pointer decreases code size a lot xa = display->xa; -#if ENABLE_FRILLS +#if XFT if (rs[Rs_depth]) set (display, strtol (rs[Rs_depth], 0, 0)); else @@ -312,6 +313,10 @@ free (r_argv); + for (int i = NUM_RESOURCES; i--; ) + if (rs [i] == resval_undef) + rs [i] = 0; + #if ENABLE_PERL if (!rs[Rs_perl_ext_1]) rs[Rs_perl_ext_1] = "default"; @@ -423,6 +428,7 @@ { if (!rs[Rs_color + Color_fg]) rs[Rs_color + Color_fg] = def_colorName[Color_bg]; + if (!rs[Rs_color + Color_bg]) rs[Rs_color + Color_bg] = def_colorName[Color_fg]; } @@ -657,55 +663,61 @@ for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) { - rxvt_color xcol; + const char *name = rs[Rs_color + i]; - if (!rs[Rs_color + i]) + if (!name) continue; - if (!set_color (xcol, rs[Rs_color + i])) + rxvt_color xcol; + + if (!set_color (xcol, name)) { #ifndef XTERM_REVERSE_VIDEO if (i < 2 && OPTION (Opt_reverseVideo)) - rs[Rs_color + i] = def_colorName[!i]; + name = def_colorName [1 - i]; else #endif - rs[Rs_color + i] = def_colorName[i]; + name = def_colorName [i]; - if (!rs[Rs_color + i]) + if (!name) continue; - if (!set_color (xcol, rs[Rs_color + i])) + if (!set_color (xcol, name)) { switch (i) { case Color_fg: case Color_bg: - /* fatal: need bg/fg color */ rxvt_warn ("unable to get foreground/background colour, continuing.\n"); + name = ""; break; #ifndef NO_CURSORCOLOR case Color_cursor2: - xcol = pix_colors[Color_fg]; - break; -#endif /* ! NO_CURSORCOLOR */ +#endif case Color_pointer_fg: + name = rs[Rs_color + Color_fg]; xcol = pix_colors[Color_fg]; break; default: - xcol = pix_colors[Color_bg]; /* None */ + name = rs[Rs_color + Color_bg]; + xcol = pix_colors[Color_bg]; break; } } } pix_colors[i] = xcol; - SET_PIXCOLOR (i); + rs[Rs_color + i] = name; } #ifdef OFF_FOCUS_FADING if (rs[Rs_fade]) for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) - pix_colors_unfocused[i] = pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); + { + rgba c; + pix_colors[Color_fade].get (c); + pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c); + } #endif if (depth <= 2) @@ -738,18 +750,18 @@ * xcol[2] == bot shadow */ xcol[1] = pix_colors[Color_scroll]; - xcol[0].set (this, rxvt_rgba (rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC)); + xcol[0].set (this, rgba (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC)); - rxvt_rgba c0, c1; + rgba c0, c1; - xcol[0].get (this, c0); - xcol[1].get (this, c1); + xcol[0].get (c0); + xcol[1].get (c1); - pix_colors[Color_bottomShadow] = xcol[1].fade (this, 50); + xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]); /* topShadowColor */ if (!xcol[1].set (this, - rxvt_rgba ( + rgba ( min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), min (c0.b, max (c1.b / 5, c1.b) * 7 / 5),