--- rxvt-unicode/src/rxvttoolkit.C 2006/02/01 01:58:47 1.45 +++ rxvt-unicode/src/rxvttoolkit.C 2006/02/01 18:36:48 1.46 @@ -397,9 +397,10 @@ rxvt_display::ref_next () { // TODO: somehow check wether the database files/resources changed - // before re-loading/parsing + // before affording re-loading/parsing XrmDestroyDatabase (XrmGetDatabase (display)); XrmSetDatabase (display, get_resources ()); + printf ("next\n");//D } rxvt_display::~rxvt_display () @@ -510,6 +511,7 @@ } #ifdef USE_XIM + void rxvt_display::reg (im_watcher *w) { imw.push_back (w); @@ -543,10 +545,11 @@ void rxvt_display::put_xim (rxvt_xim *xim) { -#if XLIB_IS_RACEFREE +# if XLIB_IS_RACEFREE xims.put (xim); -#endif +# endif } + #endif Atom rxvt_display::atom (const char *name) @@ -598,11 +601,12 @@ return XftColorAllocValue (screen->xdisp, screen->visual, screen->cmap, &d, &c); } #else + c.red = color.r; + c.green = color.g; + c.blue = color.b; + if (screen->visual->c_class == TrueColor || screen->visual->c_class == DirectColor) { - c.red = color.g; - c.green = color.g; - c.blue = color.g; c.pixel = (color.r * (screen->visual->red_mask >> ctz (screen->visual->red_mask )) / rgba::MAX_CC) << ctz (screen->visual->red_mask ) | (color.g * (screen->visual->green_mask >> ctz (screen->visual->green_mask)) @@ -612,19 +616,12 @@ return true; } + else if (XAllocColor (screen->xdisp, screen->cmap, &c)) + return true; else - { - c.red = color.r; - c.green = color.g; - c.blue = color.b; - - if (XAllocColor (screen->xdisp, screen->cmap, &c)) - return true; - else - c.pixel = (color.r + color.g + color.b) > 128*3 - ? WhitePixelOfScreen (DefaultScreenOfDisplay (screen->xdisp)) - : BlackPixelOfScreen (DefaultScreenOfDisplay (screen->xdisp)); - } + c.pixel = (color.r + color.g + color.b) > 128*3 + ? WhitePixelOfScreen (DefaultScreenOfDisplay (screen->xdisp)) + : BlackPixelOfScreen (DefaultScreenOfDisplay (screen->xdisp)); #endif return false; @@ -637,6 +634,7 @@ char eos; int skip; + // parse the nonstandard "[alphapercent]" prefix if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) { c.a = lerp (0, rgba::MAX_CC, c.a); @@ -645,8 +643,8 @@ else c.a = rgba::MAX_CC; - // parse the non-standard rgba format - if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%hx/%hx/%hx/%hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) + // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format + if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) { XColor xc, xc_exact; @@ -734,6 +732,18 @@ #endif } +void +rxvt_color::get (XColor &color) +{ + rgba c; + get (c); + + color.red = c.r; + color.green = c.g; + color.blue = c.b; + color.pixel = (Pixel)*this; +} + void rxvt_color::free (rxvt_screen *screen) {