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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines