--- rxvt-unicode/src/rxvttoolkit.C 2011/02/21 08:10:10 1.122 +++ rxvt-unicode/src/rxvttoolkit.C 2011/05/30 18:39:03 1.127 @@ -451,7 +451,7 @@ screen = DefaultScreen (dpy); root = DefaultRootWindow (dpy); - assert (ARRAY_LENGTH(xa_names) == NUM_XA); + assert (ecb_array_length (xa_names) == NUM_XA); XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); XrmSetDatabase (dpy, get_resources (false)); @@ -705,10 +705,16 @@ c.color.blue = color.b; c.color.alpha = alpha; - c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) - | insert_component (color.g, format->direct.greenMask, format->direct.green) - | insert_component (color.b, format->direct.blueMask , format->direct.blue ) - | insert_component (alpha , format->direct.alphaMask, format->direct.alpha); + // Xft wants premultiplied alpha, but abuses the alpha channel + // as blend factor, and doesn't allow us to set the alpha channel + c.color.red = c.color.red * alpha / 0xffff; + c.color.green = c.color.green * alpha / 0xffff; + c.color.blue = c.color.blue * alpha / 0xffff; + + c.pixel = insert_component (c.color.red , format->direct.redMask , format->direct.red ) + | insert_component (c.color.green, format->direct.greenMask, format->direct.green) + | insert_component (c.color.blue , format->direct.blueMask , format->direct.blue ) + | insert_component (alpha , format->direct.alphaMask, format->direct.alpha); return true; } @@ -730,9 +736,9 @@ if (screen->visual->c_class == TrueColor) { - c.pixel = (color.r >> (16 - rxvt_popcount (screen->visual->red_mask )) << rxvt_ctz (screen->visual->red_mask )) - | (color.g >> (16 - rxvt_popcount (screen->visual->green_mask)) << rxvt_ctz (screen->visual->green_mask)) - | (color.b >> (16 - rxvt_popcount (screen->visual->blue_mask )) << rxvt_ctz (screen->visual->blue_mask )); + c.pixel = (color.r >> (16 - ecb_popcount32 (screen->visual->red_mask )) << ecb_ctz32 (screen->visual->red_mask )) + | (color.g >> (16 - ecb_popcount32 (screen->visual->green_mask)) << ecb_ctz32 (screen->visual->green_mask)) + | (color.b >> (16 - ecb_popcount32 (screen->visual->blue_mask )) << ecb_ctz32 (screen->visual->blue_mask )); return true; } @@ -928,6 +934,17 @@ { int selnum = selection_type; +#if ENABLE_FRILLS + if (selnum == Sel_Primary && display->selection_owner) + { + /* internal selection */ + char *str = rxvt_wcstombs (display->selection_owner->selection.text, display->selection_owner->selection.len); + finish (str, strlen (str)); + free (str); + return; + } +#endif + #if X_HAVE_UTF8_STRING selection_type = Sel_UTF8String; if (request (display->xa[XA_UTF8_STRING], selnum)) @@ -1162,8 +1179,7 @@ case SelectionNotify: if (selection_wait == Sel_normal - && xev.xselection.time == request_time - && xev.xselection.property == request_prop) + && xev.xselection.time == request_time) { timer_ev.stop (); handle_selection (xev.xselection.requestor, xev.xselection.property, true);