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.83 by root, Fri Dec 14 05:52:33 2007 UTC vs.
Revision 1.90 by root, Wed Jan 23 14:09:21 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}
571 } 572 }
572#endif 573#endif
573 } 574 }
574} 575}
575 576
576void rxvt_display::flush ()
577{
578 flush_ev.start ();
579}
580
581void rxvt_display::flush_cb (ev::prepare &w, int revents) 577void rxvt_display::flush_cb (ev::prepare &w, int revents)
582{ 578{
583 w.stop (); 579 w.stop ();
584 XFlush (dpy); 580 XFlush (dpy);
585} 581}
603} 599}
604 600
605void rxvt_display::set_selection_owner (rxvt_term *owner) 601void rxvt_display::set_selection_owner (rxvt_term *owner)
606{ 602{
607 if (selection_owner && selection_owner != owner) 603 if (selection_owner && selection_owner != owner)
604 {
605 rxvt_term *owner = selection_owner;
606
608 selection_owner->selection_clear (); 607 owner->selection_clear ();
608 owner->flush ();
609 }
609 610
610 selection_owner = owner; 611 selection_owner = owner;
611} 612}
612 613
613#ifdef USE_XIM 614#ifdef USE_XIM
672} 673}
673 674
674bool 675bool
675rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 676rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
676{ 677{
678 //TODO: only supports 24 bit
679 int alpha = color.a >= 0xff00 ? 0xffff : color.a;
680
677#if XFT 681#if XFT
678 XRenderPictFormat *format; 682 XRenderPictFormat *format;
679 683
680 // FUCKING Xft gets it wrong, of course, so work around it. 684 // FUCKING Xft gets it wrong, of course, so work around it.
681 // Transparency users should eat shit and die, and then 685 // Transparency users should eat shit and die, and then
685 { 689 {
686 // the fun lies in doing everything manually... 690 // the fun lies in doing everything manually...
687 c.color.red = color.r; 691 c.color.red = color.r;
688 c.color.green = color.g; 692 c.color.green = color.g;
689 c.color.blue = color.b; 693 c.color.blue = color.b;
690 c.color.alpha = color.a; 694 c.color.alpha = alpha;
691 695
692 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 )
693 | insert_component (color.g, format->direct.greenMask, format->direct.green) 697 | insert_component (color.g, format->direct.greenMask, format->direct.green)
694 | insert_component (color.b, format->direct.blueMask , format->direct.blue ) 698 | insert_component (color.b, format->direct.blueMask , format->direct.blue )
695 | insert_component (color.a, format->direct.alphaMask, format->direct.alpha); 699 | insert_component (alpha , format->direct.alphaMask, format->direct.alpha);
696 700
697 return true; 701 return true;
698 } 702 }
699 else 703 else
700 { 704 {
701 XRenderColor d; 705 XRenderColor d;
702 706
703 d.red = color.r; 707 d.red = color.r;
704 d.green = color.g; 708 d.green = color.g;
705 d.blue = color.b; 709 d.blue = color.b;
706 d.alpha = color.a; 710 d.alpha = alpha;
707 711
708 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); 712 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c);
709 } 713 }
710#else 714#else
711 c.red = color.r; 715 c.red = color.r;
736{ 740{
737 rgba c; 741 rgba c;
738 char eos; 742 char eos;
739 int skip; 743 int skip;
740 744
745 c.a = rgba::MAX_CC;
746
741 // parse the nonstandard "[alphapercent]" prefix 747 // parse the nonstandard "[alphapercent]" prefix
742 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) 748 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip))
743 { 749 {
744 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); 750 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a);
745 name += skip; 751 name += skip;
746 } 752 }
747 else
748 c.a = rgba::MAX_CC;
749 753
750 // parse the non-standard "#aarrggbb" format
751 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))
752 {
753 if (c.r)
754 c.r = (c.r << 8) | 0x0ff;
755 if (c.g)
756 c.g = (c.g << 8) | 0x0ff;
757 if (c.b)
758 c.b = (c.b << 8) | 0x0ff;
759 if (c.a)
760 c.a = (c.a << 8) | 0x0ff;
761 }
762 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format 754 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format
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)) 755 if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos))
764 { 756 {
765 XColor xc; 757 XColor xc;
766 758
767 if (XParseColor (screen->dpy, screen->cmap, name, &xc)) 759 if (XParseColor (screen->dpy, screen->cmap, name, &xc))
768 { 760 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines