--- rxvt-unicode/src/rxvttoolkit.C 2011/02/21 07:18:19 1.120 +++ rxvt-unicode/src/rxvttoolkit.C 2011/05/11 18:41:33 1.125 @@ -3,7 +3,7 @@ *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. - * Copyright (c) 2003-2007 Marc Lehmann + * Copyright (c) 2003-2011 Marc Lehmann * Copyright (c) 2011 Emanuele Giaquinta * * This program is free software; you can redistribute it and/or modify @@ -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; } @@ -894,8 +900,8 @@ ); } -rxvt_selection::rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term, void *cb_sv) -: display (disp), request_time (tm), request_win (win), request_prop (prop), term (term), cb_sv (cb_sv) +rxvt_selection::rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term) +: display (disp), request_time (tm), request_win (win), request_prop (prop), term (term) { assert (selnum >= Sel_Primary && selnum <= Sel_Clipboard); @@ -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)) @@ -956,8 +973,8 @@ #if ENABLE_PERL else { - stop (); - abort (); //TODO + stop (); // we do not really trust perl callbacks + rxvt_perl.selection_finish (this, data, len); } #endif }