… | |
… | |
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 | |
193 | rxvt_xim::~rxvt_xim () |
193 | rxvt_xim::~rxvt_xim () |
… | |
… | |
666 | static unsigned int |
666 | static unsigned int |
667 | insert_component (unsigned int value, unsigned int mask, unsigned int shift) |
667 | insert_component (unsigned int value, unsigned int mask, unsigned int shift) |
668 | { |
668 | { |
669 | return (value * (mask + 1) >> 16) << shift; |
669 | return (value * (mask + 1) >> 16) << shift; |
670 | } |
670 | } |
671 | |
671 | |
672 | bool |
672 | bool |
673 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
673 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
674 | { |
674 | { |
675 | #if XFT |
675 | #if XFT |
676 | XRenderPictFormat *format; |
676 | XRenderPictFormat *format; |
… | |
… | |
758 | c.a = (c.a << 8) | 0x0ff; |
758 | c.a = (c.a << 8) | 0x0ff; |
759 | } |
759 | } |
760 | // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format |
760 | // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format |
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)) |
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)) |
762 | { |
762 | { |
763 | XColor xc, xc_exact; |
763 | XColor xc; |
764 | |
764 | |
765 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
765 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
766 | { |
766 | { |
767 | c.r = xc.red; |
767 | c.r = xc.red; |
768 | c.g = xc.green; |
768 | c.g = xc.green; |
… | |
… | |
795 | { |
795 | { |
796 | XColor *colors = new XColor [screen->visual->map_entries]; |
796 | XColor *colors = new XColor [screen->visual->map_entries]; |
797 | |
797 | |
798 | for (int i = 0; i < cmap_size; i++) |
798 | for (int i = 0; i < cmap_size; i++) |
799 | colors [i].pixel = i; |
799 | colors [i].pixel = i; |
800 | |
800 | |
801 | // many kilobytes transfer per colour, but pseudocolor isn't worth |
801 | // many kilobytes transfer per colour, but pseudocolor isn't worth |
802 | // many extra optimisations. |
802 | // many extra optimisations. |
803 | XQueryColors (screen->dpy, screen->cmap, colors, cmap_size); |
803 | XQueryColors (screen->dpy, screen->cmap, colors, cmap_size); |
804 | |
804 | |
805 | int diff = 0x7fffffffUL; |
805 | int diff = 0x7fffffffUL; |
… | |
… | |
818 | } |
818 | } |
819 | } |
819 | } |
820 | |
820 | |
821 | //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", |
822 | // 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); |
823 | |
823 | |
824 | got = alloc (screen, rgba (best->red, best->green, best->blue)); |
824 | got = alloc (screen, rgba (best->red, best->green, best->blue)); |
825 | |
825 | |
826 | delete [] colors; |
826 | delete [] colors; |
827 | } |
827 | } |
828 | #endif |
828 | #endif |
… | |
… | |
856 | color.green = c.g; |
856 | color.green = c.g; |
857 | color.blue = c.b; |
857 | color.blue = c.b; |
858 | color.pixel = (Pixel)*this; |
858 | color.pixel = (Pixel)*this; |
859 | } |
859 | } |
860 | |
860 | |
861 | void |
861 | void |
862 | rxvt_color::free (rxvt_screen *screen) |
862 | rxvt_color::free (rxvt_screen *screen) |
863 | { |
863 | { |
864 | if (screen->visual->c_class == TrueColor) |
864 | if (screen->visual->c_class == TrueColor) |
865 | return; // nothing to do |
865 | return; // nothing to do |
866 | |
866 | |