--- rxvt-unicode/src/rxvttoolkit.C 2012/06/06 20:22:04 1.136 +++ rxvt-unicode/src/rxvttoolkit.C 2014/11/02 15:52:39 1.144 @@ -8,7 +8,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -68,7 +68,7 @@ "WM_LOCALE_NAME", "XIM_SERVERS", #endif -#if ENABLE_TRANSPARENCY +#if HAVE_IMG || ENABLE_PERL "_XROOTPMAP_ID", "ESETROOT_PMAP_ID", #endif @@ -262,21 +262,41 @@ cmap = DefaultColormapOfScreen (screen); } +#if ENABLE_FRILLS + void -rxvt_screen::select_visual (int bitdepth) +rxvt_screen::select_visual (int id) { -#if XFT XVisualInfo vinfo; + vinfo.visualid = id; + int n; - if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo)) + if (XVisualInfo *vi = XGetVisualInfo (dpy, VisualIDMask, &vinfo, &n)) { - depth = bitdepth; - visual = vinfo.visual; - cmap = XCreateColormap (dpy, display->root, visual, AllocNone); + depth = vi->depth; + visual = vi->visual; + + XFree (vi); + + cmap = XCreateColormap (dpy, display->root, visual, AllocNone); } -#endif + else + rxvt_warn ("no visual found for requested id 0x%02x, using default visual.\n", id); +} + +void +rxvt_screen::select_depth (int bitdepth) +{ + XVisualInfo vinfo; + + if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo)) + select_visual (vinfo.visualid); + else + rxvt_warn ("no visual found for requested depth %d, using default visual.\n", bitdepth); } +#endif + void rxvt_screen::clear () { @@ -472,25 +492,19 @@ #if XRENDER int major, minor; if (XRenderQueryVersion (dpy, &major, &minor)) - { - flags |= DISPLAY_HAS_RENDER; - - if (major > 0 || (major == 0 && minor >= 10)) - flags |= DISPLAY_HAS_RENDER_10; - - if (major > 0 || (major == 0 && minor >= 11)) - flags |= DISPLAY_HAS_RENDER_MUL; - - XFilters *filters = XRenderQueryFilters (dpy, root); - if (filters) - { - for (int i = 0; i < filters->nfilter; i++) - if (!strcmp (filters->filter[i], FilterConvolution)) - flags |= DISPLAY_HAS_RENDER_CONV; - - XFree (filters); - } - } + if (major > 0 || (major == 0 && minor >= 11)) + { + flags |= DISPLAY_HAS_RENDER; + + if (XFilters *filters = XRenderQueryFilters (dpy, root)) + { + for (int i = 0; i < filters->nfilter; i++) + if (!strcmp (filters->filter [i], FilterConvolution)) + flags |= DISPLAY_HAS_RENDER_CONV; + + XFree (filters); + } + } #endif int fd = XConnectionNumber (dpy);