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.86 by root, Mon Dec 24 08:00:18 2007 UTC vs.
Revision 1.97 by root, Sat Jan 26 12:15:11 2008 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines