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.69 by root, Sat Jun 30 18:10:41 2007 UTC vs.
Revision 1.74 by root, Sat Nov 10 23:10:55 2007 UTC

183 183
184 XIMCallback ximcallback; 184 XIMCallback ximcallback;
185 ximcallback.client_data = (XPointer)this; 185 ximcallback.client_data = (XPointer)this;
186 ximcallback.callback = im_destroy_cb; 186 ximcallback.callback = im_destroy_cb;
187 187
188 XSetIMValues (xim, XNDestroyCallback, &ximcallback, 0); 188 XSetIMValues (xim, XNDestroyCallback, &ximcallback, (char *)0);
189 189
190 return true; 190 return true;
191} 191}
192 192
193rxvt_xim::~rxvt_xim () 193rxvt_xim::~rxvt_xim ()
443 return false; 443 return false;
444 444
445 screen = DefaultScreen (dpy); 445 screen = DefaultScreen (dpy);
446 root = DefaultRootWindow (dpy); 446 root = DefaultRootWindow (dpy);
447 447
448#ifdef HAVE_AFTERIMAGE
449 ::dpy = dpy; /* init global var from libAfter... */
450 asv = create_asvisual_for_id (dpy, screen, DefaultDepth (dpy,screen),
451 XVisualIDFromVisual (DefaultVisual (dpy, screen)), None, NULL);
452#endif
453
454 assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); 448 assert (sizeof (xa_names) / sizeof (char *) == NUM_XA);
455 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); 449 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa);
456 450
457 XrmSetDatabase (dpy, get_resources (false)); 451 XrmSetDatabase (dpy, get_resources (false));
458 452
672static unsigned int 666static unsigned int
673insert_component (unsigned int value, unsigned int mask, unsigned int shift) 667insert_component (unsigned int value, unsigned int mask, unsigned int shift)
674{ 668{
675 return (value * (mask + 1) >> 16) << shift; 669 return (value * (mask + 1) >> 16) << shift;
676} 670}
677 671
678bool 672bool
679rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 673rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
680{ 674{
681#if XFT 675#if XFT
682 XRenderPictFormat *format; 676 XRenderPictFormat *format;
749 name += skip; 743 name += skip;
750 } 744 }
751 else 745 else
752 c.a = rgba::MAX_CC; 746 c.a = rgba::MAX_CC;
753 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 }
754 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format 760 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format
755 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))
756 { 762 {
757 XColor xc, xc_exact; 763 XColor xc;
758 764
759 if (XParseColor (screen->dpy, screen->cmap, name, &xc)) 765 if (XParseColor (screen->dpy, screen->cmap, name, &xc))
760 { 766 {
761 c.r = xc.red; 767 c.r = xc.red;
762 c.g = xc.green; 768 c.g = xc.green;
789 { 795 {
790 XColor *colors = new XColor [screen->visual->map_entries]; 796 XColor *colors = new XColor [screen->visual->map_entries];
791 797
792 for (int i = 0; i < cmap_size; i++) 798 for (int i = 0; i < cmap_size; i++)
793 colors [i].pixel = i; 799 colors [i].pixel = i;
794 800
795 // many kilobytes transfer per colour, but pseudocolor isn't worth 801 // many kilobytes transfer per colour, but pseudocolor isn't worth
796 // many extra optimisations. 802 // many extra optimisations.
797 XQueryColors (screen->dpy, screen->cmap, colors, cmap_size); 803 XQueryColors (screen->dpy, screen->cmap, colors, cmap_size);
798 804
799 int diff = 0x7fffffffUL; 805 int diff = 0x7fffffffUL;
812 } 818 }
813 } 819 }
814 820
815 //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",
816 // 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);
817 823
818 got = alloc (screen, rgba (best->red, best->green, best->blue)); 824 got = alloc (screen, rgba (best->red, best->green, best->blue));
819 825
820 delete [] colors; 826 delete [] colors;
821 } 827 }
822#endif 828#endif
850 color.green = c.g; 856 color.green = c.g;
851 color.blue = c.b; 857 color.blue = c.b;
852 color.pixel = (Pixel)*this; 858 color.pixel = (Pixel)*this;
853} 859}
854 860
855void 861void
856rxvt_color::free (rxvt_screen *screen) 862rxvt_color::free (rxvt_screen *screen)
857{ 863{
858 if (screen->visual->c_class == TrueColor) 864 if (screen->visual->c_class == TrueColor)
859 return; // nothing to do 865 return; // nothing to do
860 866

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines