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.64 by root, Mon Feb 12 19:26:10 2007 UTC vs.
Revision 1.73 by ayin, Wed Oct 31 09:55:24 2007 UTC

64#endif 64#endif
65#if USE_XIM 65#if USE_XIM
66 "WM_LOCALE_NAME", 66 "WM_LOCALE_NAME",
67 "XIM_SERVERS", 67 "XIM_SERVERS",
68#endif 68#endif
69#ifdef TRANSPARENT 69#ifdef ENABLE_TRANSPARENCY
70 "_XROOTPMAP_ID", 70 "_XROOTPMAP_ID",
71 "ESETROOT_PMAP_ID", 71 "ESETROOT_PMAP_ID",
72#endif 72#endif
73#if ENABLE_XEMBED 73#if ENABLE_XEMBED
74 "_XEMBED", 74 "_XEMBED",
469 is_local = 0; 469 is_local = 0;
470 sockaddr_un sa; 470 sockaddr_un sa;
471 socklen_t sl = sizeof (sa); 471 socklen_t sl = sizeof (sa);
472 472
473 if (!getsockname (fd, (sockaddr *)&sa, &sl)) 473 if (!getsockname (fd, (sockaddr *)&sa, &sl))
474 is_local = sa.sun_family == AF_LOCAL; 474 is_local = sa.sun_family == AF_UNIX;
475 475
476 x_ev.start (fd, EVENT_READ); 476 x_ev.start (fd, EVENT_READ);
477 fcntl (fd, F_SETFD, FD_CLOEXEC); 477 fcntl (fd, F_SETFD, FD_CLOEXEC);
478 478
479 XSelectInput (dpy, root, PropertyChangeMask); 479 XSelectInput (dpy, root, PropertyChangeMask);
553 if (xev.type == PropertyNotify 553 if (xev.type == PropertyNotify
554 && xev.xany.window == root 554 && xev.xany.window == root
555 && xev.xproperty.atom == xa[XA_XIM_SERVERS]) 555 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
556 im_change_check (); 556 im_change_check ();
557#endif 557#endif
558 if (xev.type == MappingNotify)
559 XRefreshKeyboardMapping (&xev.xmapping);
560
558 for (int i = xw.size (); i--; ) 561 for (int i = xw.size (); i--; )
559 { 562 {
560 if (!xw[i]) 563 if (!xw[i])
561 xw.erase_unordered (i); 564 xw.erase_unordered (i);
562 else if (xw[i]->window == xev.xany.window) 565 else if (xw[i]->window == xev.xany.window)
663static unsigned int 666static unsigned int
664insert_component (unsigned int value, unsigned int mask, unsigned int shift) 667insert_component (unsigned int value, unsigned int mask, unsigned int shift)
665{ 668{
666 return (value * (mask + 1) >> 16) << shift; 669 return (value * (mask + 1) >> 16) << shift;
667} 670}
668 671
669bool 672bool
670rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 673rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
671{ 674{
672#if XFT 675#if XFT
673 XRenderPictFormat *format; 676 XRenderPictFormat *format;
740 name += skip; 743 name += skip;
741 } 744 }
742 else 745 else
743 c.a = rgba::MAX_CC; 746 c.a = rgba::MAX_CC;
744 747
748 // parse the non-standard "#aarrggbb" format
749 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))
750 {
751 if (c.r)
752 c.r = (c.r << 8) | 0x0ff;
753 if (c.g)
754 c.g = (c.g << 8) | 0x0ff;
755 if (c.b)
756 c.b = (c.b << 8) | 0x0ff;
757 if (c.a)
758 c.a = (c.a << 8) | 0x0ff;
759 }
745 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format 760 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format
746 if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) 761 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))
747 { 762 {
748 XColor xc, xc_exact; 763 XColor xc;
749 764
750 if (XParseColor (screen->dpy, screen->cmap, name, &xc)) 765 if (XParseColor (screen->dpy, screen->cmap, name, &xc))
751 { 766 {
752 c.r = xc.red; 767 c.r = xc.red;
753 c.g = xc.green; 768 c.g = xc.green;
780 { 795 {
781 XColor *colors = new XColor [screen->visual->map_entries]; 796 XColor *colors = new XColor [screen->visual->map_entries];
782 797
783 for (int i = 0; i < cmap_size; i++) 798 for (int i = 0; i < cmap_size; i++)
784 colors [i].pixel = i; 799 colors [i].pixel = i;
785 800
786 // many kilobytes transfer per colour, but pseudocolor isn't worth 801 // many kilobytes transfer per colour, but pseudocolor isn't worth
787 // many extra optimisations. 802 // many extra optimisations.
788 XQueryColors (screen->dpy, screen->cmap, colors, cmap_size); 803 XQueryColors (screen->dpy, screen->cmap, colors, cmap_size);
789 804
790 int diff = 0x7fffffffUL; 805 int diff = 0x7fffffffUL;
803 } 818 }
804 } 819 }
805 820
806 //rxvt_warn ("could not allocate %04x %04x %04x, getting %04x %04x %04x instead (%d)\n", 821 //rxvt_warn ("could not allocate %04x %04x %04x, getting %04x %04x %04x instead (%d)\n",
807 // color.r, color.g, color.b, best->red, best->green, best->blue, diff); 822 // color.r, color.g, color.b, best->red, best->green, best->blue, diff);
808 823
809 got = alloc (screen, rgba (best->red, best->green, best->blue)); 824 got = alloc (screen, rgba (best->red, best->green, best->blue));
810 825
811 delete [] colors; 826 delete [] colors;
812 } 827 }
813#endif 828#endif
841 color.green = c.g; 856 color.green = c.g;
842 color.blue = c.b; 857 color.blue = c.b;
843 color.pixel = (Pixel)*this; 858 color.pixel = (Pixel)*this;
844} 859}
845 860
846void 861void
847rxvt_color::free (rxvt_screen *screen) 862rxvt_color::free (rxvt_screen *screen)
848{ 863{
849 if (screen->visual->c_class == TrueColor) 864 if (screen->visual->c_class == TrueColor)
850 return; // nothing to do 865 return; // nothing to do
851 866

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines