From f46b62eea9427d4238daf598ccfe3f1ce6ae01c0 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Feb 2006 18:36:48 +0000 Subject: [PATCH] *** empty log message *** --- src/main.C | 18 ++++++++--------- src/rxvttoolkit.C | 50 ++++++++++++++++++++++++++++------------------- src/rxvttoolkit.h | 1 + 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/main.C b/src/main.C index 996562ee..2274dff8 100644 --- a/src/main.C +++ b/src/main.C @@ -952,17 +952,17 @@ done: void rxvt_term::recolour_cursor () { - XColor xcol[2]; + XColor fg, bg; - xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) - ? pix_colors_focused[Color_pointer_fg] - : pix_colors_focused[Color_fg]; - xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) - ? pix_colors_focused[Color_pointer_bg] - : pix_colors_focused[Color_bg]; + (ISSET_PIXCOLOR (Color_pointer_fg) + ? pix_colors_focused[Color_pointer_fg] + : pix_colors_focused[Color_fg]).get (fg); - XQueryColors (xdisp, cmap, xcol, 2); - XRecolorCursor (xdisp, TermWin_cursor, xcol + 0, xcol + 1); + (ISSET_PIXCOLOR (Color_pointer_bg) + ? pix_colors_focused[Color_pointer_bg] + : pix_colors_focused[Color_bg]).get (bg); + + XRecolorCursor (xdisp, TermWin_cursor, &fg, &bg); } /*----------------------------------------------------------------------*/ diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C index 4e9dcb0a..a86aa58a 100644 --- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -397,9 +397,10 @@ void 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 @@ void rxvt_display::set_selection_owner (rxvt_term *owner) } #ifdef USE_XIM + void rxvt_display::reg (im_watcher *w) { imw.push_back (w); @@ -543,10 +545,11 @@ rxvt_xim *rxvt_display::get_xim (const char *locale, const char *modifiers) 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 @@ rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 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 @@ rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 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 @@ rxvt_color::set (rxvt_screen *screen, const char *name) 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 @@ rxvt_color::set (rxvt_screen *screen, const char *name) 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 @@ rxvt_color::get (rgba &color) #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) { diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h index 879c0316..9908ca75 100644 --- a/src/rxvttoolkit.h +++ b/src/rxvttoolkit.h @@ -253,6 +253,7 @@ struct rxvt_color { void free (rxvt_screen *screen); void get (rgba &color); + void get (XColor &color); bool set (rxvt_screen *screen, const char *name); bool set (rxvt_screen *screen, const rgba &color); -- 2.34.1