ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvttoolkit.C
(Generate patch)

Comparing rxvt-unicode/src/rxvttoolkit.C (file contents):
Revision 1.120 by root, Mon Feb 21 07:18:19 2011 UTC vs.
Revision 1.126 by sf-exg, Wed May 25 08:55:52 2011 UTC

1/*----------------------------------------------------------------------* 1/*----------------------------------------------------------------------*
2 * File: rxvttoolkit.C 2 * File: rxvttoolkit.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de>
7 * Copyright (c) 2011 Emanuele Giaquinta <e.giaquinta@glauco.it> 7 * Copyright (c) 2011 Emanuele Giaquinta <e.giaquinta@glauco.it>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
703 c.color.red = color.r; 703 c.color.red = color.r;
704 c.color.green = color.g; 704 c.color.green = color.g;
705 c.color.blue = color.b; 705 c.color.blue = color.b;
706 c.color.alpha = alpha; 706 c.color.alpha = alpha;
707 707
708 // Xft wants premultiplied alpha, but abuses the alpha channel
709 // as blend factor, and doesn't allow us to set the alpha channel
710 c.color.red = c.color.red * alpha / 0xffff;
711 c.color.green = c.color.green * alpha / 0xffff;
712 c.color.blue = c.color.blue * alpha / 0xffff;
713
708 c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) 714 c.pixel = insert_component (c.color.red , format->direct.redMask , format->direct.red )
709 | insert_component (color.g, format->direct.greenMask, format->direct.green) 715 | insert_component (c.color.green, format->direct.greenMask, format->direct.green)
710 | insert_component (color.b, format->direct.blueMask , format->direct.blue ) 716 | insert_component (c.color.blue , format->direct.blueMask , format->direct.blue )
711 | insert_component (alpha , format->direct.alphaMask, format->direct.alpha); 717 | insert_component (alpha , format->direct.alphaMask, format->direct.alpha);
712 718
713 return true; 719 return true;
714 } 720 }
715 else 721 else
716 { 722 {
892 lerp (c.a, to.a, percent) 898 lerp (c.a, to.a, percent)
893 ) 899 )
894 ); 900 );
895} 901}
896 902
897rxvt_selection::rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term, void *cb_sv) 903rxvt_selection::rxvt_selection (rxvt_display *disp, int selnum, Time tm, Window win, Atom prop, rxvt_term *term)
898: display (disp), request_time (tm), request_win (win), request_prop (prop), term (term), cb_sv (cb_sv) 904: display (disp), request_time (tm), request_win (win), request_prop (prop), term (term)
899{ 905{
900 assert (selnum >= Sel_Primary && selnum <= Sel_Clipboard); 906 assert (selnum >= Sel_Primary && selnum <= Sel_Clipboard);
901 907
902 timer_ev.set<rxvt_selection, &rxvt_selection::timer_cb> (this); 908 timer_ev.set<rxvt_selection, &rxvt_selection::timer_cb> (this);
903 timer_ev.repeat = 10.; 909 timer_ev.repeat = 10.;
925 931
926void 932void
927rxvt_selection::run () 933rxvt_selection::run ()
928{ 934{
929 int selnum = selection_type; 935 int selnum = selection_type;
936
937#if ENABLE_FRILLS
938 if (selnum == Sel_Primary && display->selection_owner)
939 {
940 /* internal selection */
941 char *str = rxvt_wcstombs (display->selection_owner->selection.text, display->selection_owner->selection.len);
942 finish (str, strlen (str));
943 free (str);
944 return;
945 }
946#endif
930 947
931#if X_HAVE_UTF8_STRING 948#if X_HAVE_UTF8_STRING
932 selection_type = Sel_UTF8String; 949 selection_type = Sel_UTF8String;
933 if (request (display->xa[XA_UTF8_STRING], selnum)) 950 if (request (display->xa[XA_UTF8_STRING], selnum))
934 return; 951 return;
954 delete this; 971 delete this;
955 } 972 }
956#if ENABLE_PERL 973#if ENABLE_PERL
957 else 974 else
958 { 975 {
959 stop (); 976 stop (); // we do not really trust perl callbacks
960 abort (); //TODO 977 rxvt_perl.selection_finish (this, data, len);
961 } 978 }
962#endif 979#endif
963} 980}
964 981
965bool 982bool
1160 handle_selection (xev.xproperty.window, xev.xproperty.atom, true); 1177 handle_selection (xev.xproperty.window, xev.xproperty.atom, true);
1161 break; 1178 break;
1162 1179
1163 case SelectionNotify: 1180 case SelectionNotify:
1164 if (selection_wait == Sel_normal 1181 if (selection_wait == Sel_normal
1165 && xev.xselection.time == request_time 1182 && xev.xselection.time == request_time)
1166 && xev.xselection.property == request_prop)
1167 { 1183 {
1168 timer_ev.stop (); 1184 timer_ev.stop ();
1169 handle_selection (xev.xselection.requestor, xev.xselection.property, true); 1185 handle_selection (xev.xselection.requestor, xev.xselection.property, true);
1170 } 1186 }
1171 break; 1187 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines