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.94 by root, Sat Jan 26 11:37:51 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}
549 XEvent xev; 550 XEvent xev;
550 XNextEvent (dpy, &xev); 551 XNextEvent (dpy, &xev);
551 552
552#ifdef USE_XIM 553#ifdef USE_XIM
553 if (!XFilterEvent (&xev, None)) 554 if (!XFilterEvent (&xev, None))
555#endif
554 { 556 {
555 if (xev.type == PropertyNotify 557 if (xev.type == PropertyNotify
556 && xev.xany.window == root 558 && xev.xany.window == root
557 && xev.xproperty.atom == xa[XA_XIM_SERVERS]) 559 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
558 im_change_check (); 560 im_change_check ();
559#endif 561
560 if (xev.type == MappingNotify) 562 if (xev.type == MappingNotify)
561 XRefreshKeyboardMapping (&xev.xmapping); 563 XRefreshKeyboardMapping (&xev.xmapping);
562 564
563 for (int i = xw.size (); i--; ) 565 for (int i = xw.size (); i--; )
564 { 566 {
565 if (!xw[i]) 567 if (!xw[i])
566 xw.erase_unordered (i); 568 xw.erase_unordered (i);
567 else if (xw[i]->window == xev.xany.window) 569 else if (xw[i]->window == xev.xany.window)
568 xw[i]->call (xev); 570 xw[i]->call (xev);
569 } 571 }
570#ifdef USE_XIM
571 } 572 }
572#endif
573 } 573 }
574}
575
576void rxvt_display::flush ()
577{
578 flush_ev.start ();
579} 574}
580 575
581void rxvt_display::flush_cb (ev::prepare &w, int revents) 576void rxvt_display::flush_cb (ev::prepare &w, int revents)
582{ 577{
583 w.stop (); 578 w.stop ();
603} 598}
604 599
605void rxvt_display::set_selection_owner (rxvt_term *owner) 600void rxvt_display::set_selection_owner (rxvt_term *owner)
606{ 601{
607 if (selection_owner && selection_owner != owner) 602 if (selection_owner && selection_owner != owner)
603 {
604 rxvt_term *owner = selection_owner;
605
608 selection_owner->selection_clear (); 606 owner->selection_clear ();
607 owner->flush ();
608 }
609 609
610 selection_owner = owner; 610 selection_owner = owner;
611} 611}
612 612
613#ifdef USE_XIM 613#ifdef USE_XIM
672} 672}
673 673
674bool 674bool
675rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 675rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
676{ 676{
677 //TODO: only supports 24 bit
678 int alpha = color.a >= 0xff00 ? 0xffff : color.a;
679
677#if XFT 680#if XFT
678 XRenderPictFormat *format; 681 XRenderPictFormat *format;
679 682
680 // FUCKING Xft gets it wrong, of course, so work around it. 683 // FUCKING Xft gets it wrong, of course, so work around it.
681 // Transparency users should eat shit and die, and then 684 // Transparency users should eat shit and die, and then
685 { 688 {
686 // the fun lies in doing everything manually... 689 // the fun lies in doing everything manually...
687 c.color.red = color.r; 690 c.color.red = color.r;
688 c.color.green = color.g; 691 c.color.green = color.g;
689 c.color.blue = color.b; 692 c.color.blue = color.b;
690 c.color.alpha = color.a; 693 c.color.alpha = alpha;
691 694
692 c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) 695 c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red )
693 | insert_component (color.g, format->direct.greenMask, format->direct.green) 696 | insert_component (color.g, format->direct.greenMask, format->direct.green)
694 | insert_component (color.b, format->direct.blueMask , format->direct.blue ) 697 | insert_component (color.b, format->direct.blueMask , format->direct.blue )
695 | insert_component (color.a, format->direct.alphaMask, format->direct.alpha); 698 | insert_component (alpha , format->direct.alphaMask, format->direct.alpha);
696 699
697 return true; 700 return true;
698 } 701 }
699 else 702 else
700 { 703 {
701 XRenderColor d; 704 XRenderColor d;
702 705
703 d.red = color.r; 706 d.red = color.r;
704 d.green = color.g; 707 d.green = color.g;
705 d.blue = color.b; 708 d.blue = color.b;
706 d.alpha = color.a; 709 d.alpha = alpha;
707 710
708 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); 711 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c);
709 } 712 }
710#else 713#else
711 c.red = color.r; 714 c.red = color.r;
736{ 739{
737 rgba c; 740 rgba c;
738 char eos; 741 char eos;
739 int skip; 742 int skip;
740 743
744 c.a = rgba::MAX_CC;
745
741 // parse the nonstandard "[alphapercent]" prefix 746 // parse the nonstandard "[alphapercent]" prefix
742 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) 747 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip))
743 { 748 {
744 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); 749 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a);
745 name += skip; 750 name += skip;
746 } 751 }
747 else
748 c.a = rgba::MAX_CC;
749 752
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 753 // 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)) 754 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 { 755 {
765 XColor xc; 756 XColor xc;
766 757
767 if (XParseColor (screen->dpy, screen->cmap, name, &xc)) 758 if (XParseColor (screen->dpy, screen->cmap, name, &xc))
768 { 759 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines