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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines