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.85 by root, Sun Dec 16 19:44:48 2007 UTC vs.
Revision 1.96 by root, Sat Jan 26 12:12:38 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 XFlush (dpy);
579 if (XEventsQueued (dpy, QueuedAfterReading))
580 x_cb(x_ev,0);//D
581 XFlush (dpy);
582 if (XEventsQueued (dpy, QueuedAfterReading))
583 x_cb(x_ev,0);//D
584 XFlush (dpy);
579 w.stop (); 585 w.stop ();
580 XFlush (dpy);
581} 586}
582 587
583void rxvt_display::reg (xevent_watcher *w) 588void rxvt_display::reg (xevent_watcher *w)
584{ 589{
585 if (!w->active) 590 if (!w->active)
599} 604}
600 605
601void rxvt_display::set_selection_owner (rxvt_term *owner) 606void rxvt_display::set_selection_owner (rxvt_term *owner)
602{ 607{
603 if (selection_owner && selection_owner != owner) 608 if (selection_owner && selection_owner != owner)
609 {
610 rxvt_term *owner = selection_owner;
611
604 selection_owner->selection_clear (); 612 owner->selection_clear ();
613 owner->flush ();
614 }
605 615
606 selection_owner = owner; 616 selection_owner = owner;
607} 617}
608 618
609#ifdef USE_XIM 619#ifdef USE_XIM
668} 678}
669 679
670bool 680bool
671rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 681rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
672{ 682{
683 //TODO: only supports 24 bit
684 int alpha = color.a >= 0xff00 ? 0xffff : color.a;
685
673#if XFT 686#if XFT
674 XRenderPictFormat *format; 687 XRenderPictFormat *format;
675 688
676 // FUCKING Xft gets it wrong, of course, so work around it. 689 // FUCKING Xft gets it wrong, of course, so work around it.
677 // Transparency users should eat shit and die, and then 690 // Transparency users should eat shit and die, and then
681 { 694 {
682 // the fun lies in doing everything manually... 695 // the fun lies in doing everything manually...
683 c.color.red = color.r; 696 c.color.red = color.r;
684 c.color.green = color.g; 697 c.color.green = color.g;
685 c.color.blue = color.b; 698 c.color.blue = color.b;
686 c.color.alpha = color.a; 699 c.color.alpha = alpha;
687 700
688 c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) 701 c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red )
689 | insert_component (color.g, format->direct.greenMask, format->direct.green) 702 | insert_component (color.g, format->direct.greenMask, format->direct.green)
690 | insert_component (color.b, format->direct.blueMask , format->direct.blue ) 703 | insert_component (color.b, format->direct.blueMask , format->direct.blue )
691 | insert_component (color.a, format->direct.alphaMask, format->direct.alpha); 704 | insert_component (alpha , format->direct.alphaMask, format->direct.alpha);
692 705
693 return true; 706 return true;
694 } 707 }
695 else 708 else
696 { 709 {
697 XRenderColor d; 710 XRenderColor d;
698 711
699 d.red = color.r; 712 d.red = color.r;
700 d.green = color.g; 713 d.green = color.g;
701 d.blue = color.b; 714 d.blue = color.b;
702 d.alpha = color.a; 715 d.alpha = alpha;
703 716
704 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); 717 return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c);
705 } 718 }
706#else 719#else
707 c.red = color.r; 720 c.red = color.r;
732{ 745{
733 rgba c; 746 rgba c;
734 char eos; 747 char eos;
735 int skip; 748 int skip;
736 749
750 c.a = rgba::MAX_CC;
751
737 // parse the nonstandard "[alphapercent]" prefix 752 // parse the nonstandard "[alphapercent]" prefix
738 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) 753 if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip))
739 { 754 {
740 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); 755 c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a);
741 name += skip; 756 name += skip;
742 } 757 }
743 else
744 c.a = rgba::MAX_CC;
745 758
746 // parse the non-standard "#aarrggbb" format
747 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))
748 {
749 if (c.r)
750 c.r = (c.r << 8) | 0x0ff;
751 if (c.g)
752 c.g = (c.g << 8) | 0x0ff;
753 if (c.b)
754 c.b = (c.b << 8) | 0x0ff;
755 if (c.a)
756 c.a = (c.a << 8) | 0x0ff;
757 }
758 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format 759 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format
759 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)) 760 if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos))
760 { 761 {
761 XColor xc; 762 XColor xc;
762 763
763 if (XParseColor (screen->dpy, screen->cmap, name, &xc)) 764 if (XParseColor (screen->dpy, screen->cmap, name, &xc))
764 { 765 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines