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.125 by root, Wed May 11 18:41:33 2011 UTC vs.
Revision 1.130 by sf-exg, Fri Jan 13 12:40:53 2012 UTC

449 return false; 449 return false;
450 450
451 screen = DefaultScreen (dpy); 451 screen = DefaultScreen (dpy);
452 root = DefaultRootWindow (dpy); 452 root = DefaultRootWindow (dpy);
453 453
454 assert (ARRAY_LENGTH(xa_names) == NUM_XA); 454 assert (ecb_array_length (xa_names) == NUM_XA);
455 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); 455 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa);
456 456
457 XrmSetDatabase (dpy, get_resources (false)); 457 XrmSetDatabase (dpy, get_resources (false));
458 458
459#ifdef POINTER_BLANK 459#ifdef POINTER_BLANK
686 686
687bool 687bool
688rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 688rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
689{ 689{
690 //TODO: only supports 24 bit 690 //TODO: only supports 24 bit
691 int alpha = color.a >= 0xff00 ? 0xffff : color.a; 691 unsigned int alpha = color.a >= 0xff00 ? 0xffff : color.a;
692 692
693#if XFT 693#if XFT
694 XRenderPictFormat *format; 694 XRenderPictFormat *format;
695 695
696 // FUCKING Xft gets it wrong, of course, so work around it. 696 // FUCKING Xft gets it wrong, of course, so work around it.
725 d.red = color.r; 725 d.red = color.r;
726 d.green = color.g; 726 d.green = color.g;
727 d.blue = color.b; 727 d.blue = color.b;
728 d.alpha = alpha; 728 d.alpha = alpha;
729 729
730 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); 730 if (XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c))
731 return true;
731 } 732 }
732#else 733#else
733 c.red = color.r; 734 c.red = color.r;
734 c.green = color.g; 735 c.green = color.g;
735 c.blue = color.b; 736 c.blue = color.b;
736 737
737 if (screen->visual->c_class == TrueColor) 738 if (screen->visual->c_class == TrueColor)
738 { 739 {
739 c.pixel = (color.r >> (16 - rxvt_popcount (screen->visual->red_mask )) << rxvt_ctz (screen->visual->red_mask )) 740 c.pixel = (color.r >> (16 - ecb_popcount32 (screen->visual->red_mask )) << ecb_ctz32 (screen->visual->red_mask ))
740 | (color.g >> (16 - rxvt_popcount (screen->visual->green_mask)) << rxvt_ctz (screen->visual->green_mask)) 741 | (color.g >> (16 - ecb_popcount32 (screen->visual->green_mask)) << ecb_ctz32 (screen->visual->green_mask))
741 | (color.b >> (16 - rxvt_popcount (screen->visual->blue_mask )) << rxvt_ctz (screen->visual->blue_mask )); 742 | (color.b >> (16 - ecb_popcount32 (screen->visual->blue_mask )) << ecb_ctz32 (screen->visual->blue_mask ));
742 743
743 return true; 744 return true;
744 } 745 }
745 else if (XAllocColor (screen->dpy, screen->cmap, &c)) 746 else if (XAllocColor (screen->dpy, screen->cmap, &c))
746 return true; 747 return true;
747 else 748#endif
749
748 c.pixel = (color.r + color.g + color.b) > 128*3 750 c.pixel = (color.r + color.g + color.b) > 128*3
749 ? WhitePixelOfScreen (DefaultScreenOfDisplay (screen->dpy)) 751 ? WhitePixelOfScreen (DefaultScreenOfDisplay (screen->dpy))
750 : BlackPixelOfScreen (DefaultScreenOfDisplay (screen->dpy)); 752 : BlackPixelOfScreen (DefaultScreenOfDisplay (screen->dpy));
751#endif
752 753
753 return false; 754 return false;
754} 755}
755 756
756bool 757bool
911 912
912 incr_buf = 0; 913 incr_buf = 0;
913 incr_buf_size = incr_buf_fill = 0; 914 incr_buf_size = incr_buf_fill = 0;
914 selection_wait = Sel_normal; 915 selection_wait = Sel_normal;
915 selection_type = selnum; 916 selection_type = selnum;
917 cb_sv = 0;
916} 918}
917 919
918void 920void
919rxvt_selection::stop () 921rxvt_selection::stop ()
920{ 922{
960} 962}
961 963
962void 964void
963rxvt_selection::finish (char *data, unsigned int len) 965rxvt_selection::finish (char *data, unsigned int len)
964{ 966{
965 if (term) 967 if (!cb_sv)
966 { 968 {
967 if (data) 969 if (data)
968 term->paste (data, len); 970 term->paste (data, len);
969 971
970 term->selection_req = 0; 972 term->selection_req = 0;
1177 handle_selection (xev.xproperty.window, xev.xproperty.atom, true); 1179 handle_selection (xev.xproperty.window, xev.xproperty.atom, true);
1178 break; 1180 break;
1179 1181
1180 case SelectionNotify: 1182 case SelectionNotify:
1181 if (selection_wait == Sel_normal 1183 if (selection_wait == Sel_normal
1182 && xev.xselection.time == request_time 1184 && xev.xselection.time == request_time)
1183 && xev.xselection.property == request_prop)
1184 { 1185 {
1185 timer_ev.stop (); 1186 timer_ev.stop ();
1186 handle_selection (xev.xselection.requestor, xev.xselection.property, true); 1187 handle_selection (xev.xselection.requestor, xev.xselection.property, true);
1187 } 1188 }
1188 break; 1189 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines