ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.C
(Generate patch)

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.97 by sf-exg, Fri Oct 22 18:03:10 2010 UTC vs.
Revision 1.101 by sf-exg, Sun Oct 31 08:28:04 2010 UTC

729 return false; 729 return false;
730 730
731 if (!pixbuf) 731 if (!pixbuf)
732 return false; 732 return false;
733 733
734#if !XFT 734#if !XRENDER
735 if (background_flags) 735 if (background_flags)
736 return false; 736 return false;
737#endif 737#endif
738 738
739 GdkPixbuf *result; 739 GdkPixbuf *result;
856 dst_width, dst_height, 856 dst_width, dst_height,
857 XLIB_RGB_DITHER_NONE, 857 XLIB_RGB_DITHER_NONE,
858 0, 0); 858 0, 0);
859 } 859 }
860 860
861#if XFT 861#if XRENDER
862 if (background_flags) 862 if (background_flags)
863 { 863 {
864 Display *dpy = target->dpy; 864 Display *dpy = target->dpy;
865 XRenderPictureAttributes pa; 865 XRenderPictureAttributes pa;
866 866
1000 if (v_blurRadius == 0 && h_blurRadius == 0) 1000 if (v_blurRadius == 0 && h_blurRadius == 0)
1001 flags &= ~blurNeeded; 1001 flags &= ~blurNeeded;
1002 else 1002 else
1003 flags |= blurNeeded; 1003 flags |= blurNeeded;
1004 1004
1005#if XFT 1005#if XRENDER
1006 XFilters *filters = XRenderQueryFilters (target->dpy, target->display->root); 1006 XFilters *filters = XRenderQueryFilters (target->dpy, target->display->root);
1007 if (filters) 1007 if (filters)
1008 { 1008 {
1009 for (int i = 0; i < filters->nfilter; i++) 1009 for (int i = 0; i < filters->nfilter; i++)
1010 if (!strcmp (filters->filter[i], FilterConvolution)) 1010 if (!strcmp (filters->filter[i], FilterConvolution))
1050 { 1050 {
1051 if (flags & bgPixmap_t::tintWholesome) 1051 if (flags & bgPixmap_t::tintWholesome)
1052 flags |= bgPixmap_t::tintServerSide; 1052 flags |= bgPixmap_t::tintServerSide;
1053 else 1053 else
1054 { 1054 {
1055#if XFT 1055#if XRENDER
1056 flags |= bgPixmap_t::tintServerSide; 1056 flags |= bgPixmap_t::tintServerSide;
1057#endif 1057#endif
1058 } 1058 }
1059 } 1059 }
1060 1060
1107 } 1107 }
1108 1108
1109 return false; 1109 return false;
1110} 1110}
1111 1111
1112#if XFT 1112#if XRENDER
1113static void 1113static void
1114get_gaussian_kernel (int radius, int width, double *kernel, XFixed *params) 1114get_gaussian_kernel (int radius, int width, double *kernel, XFixed *params)
1115{ 1115{
1116 double sigma = radius / 2.0; 1116 double sigma = radius / 2.0;
1117 double scale = sqrt (2.0 * M_PI) * sigma; 1117 double scale = sqrt (2.0 * M_PI) * sigma;
1134 1134
1135bool 1135bool
1136bgPixmap_t::blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height) 1136bgPixmap_t::blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height)
1137{ 1137{
1138 bool ret = false; 1138 bool ret = false;
1139#if XFT 1139#if XRENDER
1140 int size = max (h_blurRadius, v_blurRadius) * 2 + 1; 1140 int size = max (h_blurRadius, v_blurRadius) * 2 + 1;
1141 double *kernel = (double *)malloc (size * sizeof (double)); 1141 double *kernel = (double *)malloc (size * sizeof (double));
1142 XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed)); 1142 XFixed *params = (XFixed *)malloc ((size + 2) * sizeof (XFixed));
1143 1143
1144 Display *dpy = target->dpy; 1144 Display *dpy = target->dpy;
1221 XFreeGC (dpy, gc); 1221 XFreeGC (dpy, gc);
1222 } 1222 }
1223 } 1223 }
1224 else 1224 else
1225 { 1225 {
1226# if XFT 1226# if XRENDER
1227 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); 1227 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
1228 1228
1229 if (flags & tintSet) 1229 if (flags & tintSet)
1230 tint.get (c); 1230 tint.get (c);
1231 1231
1284 1284
1285 return ret; 1285 return ret;
1286} 1286}
1287 1287
1288/* make_transparency_pixmap() 1288/* make_transparency_pixmap()
1289 * Builds a pixmap sized the same as terminal window, with depth same as the root window 1289 * Builds a pixmap of the same size as the terminal window that contains
1290 * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by 1290 * the tiled portion of the root pixmap that is supposed to be covered by
1291 * our window. 1291 * our window.
1292 */ 1292 */
1293unsigned long 1293unsigned long
1294bgPixmap_t::make_transparency_pixmap () 1294bgPixmap_t::make_transparency_pixmap ()
1295{ 1295{
1304 Window root = target->display->root; 1304 Window root = target->display->root;
1305 int screen = target->display->screen; 1305 int screen = target->display->screen;
1306 Display *dpy = target->dpy; 1306 Display *dpy = target->dpy;
1307 int root_width = DisplayWidth (dpy, screen); 1307 int root_width = DisplayWidth (dpy, screen);
1308 int root_height = DisplayHeight (dpy, screen); 1308 int root_height = DisplayHeight (dpy, screen);
1309 unsigned int root_pmap_width, root_pmap_height;
1310 int window_width = target->szHint.width; 1309 int window_width = target->szHint.width;
1311 int window_height = target->szHint.height; 1310 int window_height = target->szHint.height;
1312 int sx, sy; 1311 int sx, sy;
1313 XGCValues gcv; 1312 XGCValues gcv;
1314 GC gc; 1313 GC gc;
1318 /* check if we are outside of the visible part of the virtual screen : */ 1317 /* check if we are outside of the visible part of the virtual screen : */
1319 if (sx + window_width <= 0 || sy + window_height <= 0 1318 if (sx + window_width <= 0 || sy + window_height <= 0
1320 || sx >= root_width || sy >= root_height) 1319 || sx >= root_width || sy >= root_height)
1321 return 0; 1320 return 0;
1322 1321
1323 if (root_pixmap != None)
1324 {
1325 /* we want to validate the pixmap and get its size at the same time : */
1326 int junk;
1327 unsigned int ujunk;
1328 /* root pixmap may be bad - allow a error */
1329 target->allowedxerror = -1;
1330
1331 if (!XGetGeometry (dpy, root_pixmap, &root, &junk, &junk, &root_pmap_width, &root_pmap_height, &ujunk, &ujunk))
1332 root_pixmap = None;
1333
1334 target->allowedxerror = 0;
1335 }
1336
1337 if (root_pixmap == None) 1322 if (root_pixmap == None)
1338 return 0; 1323 return 0;
1339 1324
1340 Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); 1325 Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth);
1341 1326
1386 } 1371 }
1387 1372
1388 return result; 1373 return result;
1389} 1374}
1390 1375
1391bool 1376void
1392bgPixmap_t::set_root_pixmap () 1377bgPixmap_t::set_root_pixmap ()
1393{ 1378{
1394 Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); 1379 Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID);
1395 if (new_root_pixmap == None) 1380 if (new_root_pixmap == None)
1396 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); 1381 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID);
1397 1382
1398 if (new_root_pixmap != root_pixmap)
1399 {
1400 root_pixmap = new_root_pixmap; 1383 root_pixmap = new_root_pixmap;
1401 return true; 1384
1385 // validate root pixmap
1386 if (root_pixmap != None)
1402 } 1387 {
1388 unsigned int width, height;
1389 Window wdummy;
1390 int idummy;
1391 unsigned int udummy;
1403 1392
1404 return false; 1393 target->allowedxerror = -1;
1394
1395 if (!XGetGeometry (target->dpy, root_pixmap, &wdummy, &idummy, &idummy, &width, &height, &udummy, &udummy))
1396 root_pixmap = None;
1397
1398 target->allowedxerror = 0;
1399 }
1405} 1400}
1406# endif /* ENABLE_TRANSPARENCY */ 1401# endif /* ENABLE_TRANSPARENCY */
1407 1402
1408# ifndef HAVE_AFTERIMAGE 1403# ifndef HAVE_AFTERIMAGE
1409static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm); 1404static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm);
1447 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); 1442 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap);
1448 } 1443 }
1449 1444
1450 if (result) 1445 if (result)
1451 { 1446 {
1452# if !defined(HAVE_AFTERIMAGE) && !XFT 1447# if !defined(HAVE_AFTERIMAGE) && !XRENDER
1453 /* our own client-side tinting */ 1448 /* our own client-side tinting */
1454 /* ATTENTION: We ASSUME that XFT will let us do all the tinting necessary server-side.
1455 This may need to be changed in need_client_side_rendering() logic is altered !!! */
1456 if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) 1449 if (!(background_flags & transpPmapTinted) && (flags & tintNeeded))
1457 { 1450 {
1458 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); 1451 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
1459 if (flags & tintSet) 1452 if (flags & tintSet)
1460 tint.get (c); 1453 tint.get (c);
1589 } 1582 }
1590} 1583}
1591 1584
1592#endif /* HAVE_BG_PIXMAP */ 1585#endif /* HAVE_BG_PIXMAP */
1593 1586
1594#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT 1587#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XRENDER
1595/* taken from aterm-0.4.2 */ 1588/* taken from aterm-0.4.2 */
1596 1589
1597static void 1590static void
1598ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm) 1591ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm)
1599{ 1592{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines