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.84 by root, Fri Dec 14 06:17:27 2007 UTC vs.
Revision 1.88 by root, Wed Jan 23 09:14:58 2008 UTC

501 501
502#ifdef POINTER_BLANK 502#ifdef POINTER_BLANK
503 XFreeCursor (dpy, blank_cursor); 503 XFreeCursor (dpy, blank_cursor);
504#endif 504#endif
505 x_ev.stop (); 505 x_ev.stop ();
506 flush_ev.stop ();
506#ifdef USE_XIM 507#ifdef USE_XIM
507 xims.clear (); 508 xims.clear ();
508#endif 509#endif
509 XCloseDisplay (dpy); 510 XCloseDisplay (dpy);
510} 511}
598} 599}
599 600
600void rxvt_display::set_selection_owner (rxvt_term *owner) 601void rxvt_display::set_selection_owner (rxvt_term *owner)
601{ 602{
602 if (selection_owner && selection_owner != owner) 603 if (selection_owner && selection_owner != owner)
604 {
605 rxvt_term *owner = selection_owner;
606
603 selection_owner->selection_clear (); 607 owner->selection_clear ();
608 owner->flush ();
609 }
604 610
605 selection_owner = owner; 611 selection_owner = owner;
606} 612}
607 613
608#ifdef USE_XIM 614#ifdef USE_XIM
667} 673}
668 674
669bool 675bool
670rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 676rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
671{ 677{
678 //TODO: only supports 24 bit truecolour
679 int alpha = color.a >= 0xff00 ? 0xffff : color.a;
680
672#if XFT 681#if XFT
673 XRenderPictFormat *format; 682 XRenderPictFormat *format;
674 683
675 // FUCKING Xft gets it wrong, of course, so work around it. 684 // FUCKING Xft gets it wrong, of course, so work around it.
676 // Transparency users should eat shit and die, and then 685 // Transparency users should eat shit and die, and then
680 { 689 {
681 // the fun lies in doing everything manually... 690 // the fun lies in doing everything manually...
682 c.color.red = color.r; 691 c.color.red = color.r;
683 c.color.green = color.g; 692 c.color.green = color.g;
684 c.color.blue = color.b; 693 c.color.blue = color.b;
685 c.color.alpha = color.a; 694 c.color.alpha = alpha;
686 695
687 c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) 696 c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red )
688 | insert_component (color.g, format->direct.greenMask, format->direct.green) 697 | insert_component (color.g, format->direct.greenMask, format->direct.green)
689 | insert_component (color.b, format->direct.blueMask , format->direct.blue ) 698 | insert_component (color.b, format->direct.blueMask , format->direct.blue )
690 | insert_component (color.a, format->direct.alphaMask, format->direct.alpha); 699 | insert_component (alpha , format->direct.alphaMask, format->direct.alpha);
691 700
692 return true; 701 return true;
693 } 702 }
694 else 703 else
695 { 704 {
696 XRenderColor d; 705 XRenderColor d;
697 706
698 d.red = color.r; 707 d.red = color.r;
699 d.green = color.g; 708 d.green = color.g;
700 d.blue = color.b; 709 d.blue = color.b;
701 d.alpha = color.a; 710 d.alpha = alpha;
702 711
703 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); 712 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c);
704 } 713 }
705#else 714#else
706 c.red = color.r; 715 c.red = color.r;
743 c.a = rgba::MAX_CC; 752 c.a = rgba::MAX_CC;
744 753
745 // parse the non-standard "#aarrggbb" format 754 // parse the non-standard "#aarrggbb" format
746 if (name[0] == '#' && strlen (name) == 1+2+2+2+2 && 4 == sscanf (name+1, "%2hx%2hx%2hx%2hx%c", &c.a, &c.r, &c.g, &c.b, &eos)) 755 if (name[0] == '#' && strlen (name) == 1+2+2+2+2 && 4 == sscanf (name+1, "%2hx%2hx%2hx%2hx%c", &c.a, &c.r, &c.g, &c.b, &eos))
747 { 756 {
748 if (c.r) 757 c.r <<= 8;
749 c.r = (c.r << 8) | 0x0ff; 758 c.g <<= 8;
750 if (c.g) 759 c.b <<= 8;
751 c.g = (c.g << 8) | 0x0ff; 760 c.a <<= 8;
752 if (c.b)
753 c.b = (c.b << 8) | 0x0ff;
754 if (c.a)
755 c.a = (c.a << 8) | 0x0ff;
756 } 761 }
757 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format 762 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format
758 else if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) 763 else if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos))
759 { 764 {
760 XColor xc; 765 XColor xc;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines