… | |
… | |
254 | } |
254 | } |
255 | |
255 | |
256 | bool |
256 | bool |
257 | bgPixmap_t::set_geometry (const char *geom) |
257 | bgPixmap_t::set_geometry (const char *geom) |
258 | { |
258 | { |
|
|
259 | bool changed = false; |
259 | int geom_flags = 0, changed = 0; |
260 | int geom_flags = 0; |
260 | int x = 0, y = 0; |
261 | int x = 0, y = 0; |
261 | unsigned int w = 0, h = 0; |
262 | unsigned int w = 0, h = 0; |
262 | unsigned int n; |
263 | unsigned int n; |
263 | unsigned long new_flags = (flags & (~geometryFlags)); |
264 | unsigned long new_flags = (flags & (~geometryFlags)); |
264 | const char *p; |
265 | const char *p; |
… | |
… | |
420 | |
421 | |
421 | while (*ops != ':' && *ops != '\0') ++ops; |
422 | while (*ops != ':' && *ops != '\0') ++ops; |
422 | } /* done parsing ops */ |
423 | } /* done parsing ops */ |
423 | } |
424 | } |
424 | |
425 | |
425 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) ++changed; |
426 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true; |
426 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) ++changed; |
427 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true; |
427 | if (check_set_align_value (geom_flags, XValue, h_align, x)) ++changed; |
428 | if (check_set_align_value (geom_flags, XValue, h_align, x)) changed = true; |
428 | if (check_set_align_value (geom_flags, YValue, v_align, y)) ++changed; |
429 | if (check_set_align_value (geom_flags, YValue, v_align, y)) changed = true; |
429 | } |
430 | } |
430 | |
431 | |
431 | if (new_flags != flags) |
432 | if (new_flags != flags) |
432 | { |
433 | { |
433 | flags = new_flags; |
434 | flags = new_flags; |
434 | changed++; |
435 | changed = true; |
435 | } |
436 | } |
436 | |
437 | |
437 | return (changed > 0); |
438 | return changed; |
438 | } |
439 | } |
439 | |
440 | |
440 | void |
441 | void |
441 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
442 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
442 | { |
443 | { |
… | |
… | |
971 | } |
972 | } |
972 | |
973 | |
973 | bool |
974 | bool |
974 | bgPixmap_t::set_blur_radius (const char *geom) |
975 | bgPixmap_t::set_blur_radius (const char *geom) |
975 | { |
976 | { |
976 | int changed = 0; |
977 | bool changed = false; |
977 | unsigned int hr, vr; |
978 | unsigned int hr, vr; |
978 | int junk; |
979 | int junk; |
979 | int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); |
980 | int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); |
980 | |
981 | |
981 | if (!(geom_flags & WidthValue)) |
982 | if (!(geom_flags & WidthValue)) |
… | |
… | |
986 | min_it (hr, 128); |
987 | min_it (hr, 128); |
987 | min_it (vr, 128); |
988 | min_it (vr, 128); |
988 | |
989 | |
989 | if (h_blurRadius != hr) |
990 | if (h_blurRadius != hr) |
990 | { |
991 | { |
991 | ++changed; |
992 | changed = true; |
992 | h_blurRadius = hr; |
993 | h_blurRadius = hr; |
993 | } |
994 | } |
994 | |
995 | |
995 | if (v_blurRadius != vr) |
996 | if (v_blurRadius != vr) |
996 | { |
997 | { |
997 | ++changed; |
998 | changed = true; |
998 | v_blurRadius = vr; |
999 | v_blurRadius = vr; |
999 | } |
1000 | } |
1000 | |
1001 | |
1001 | if (v_blurRadius == 0 && h_blurRadius == 0) |
1002 | if (v_blurRadius == 0 && h_blurRadius == 0) |
1002 | flags &= ~blurNeeded; |
1003 | flags &= ~blurNeeded; |
1003 | else |
1004 | else |
1004 | flags |= blurNeeded; |
1005 | flags |= blurNeeded; |
1005 | |
1006 | |
1006 | return (changed > 0); |
1007 | return changed; |
1007 | } |
1008 | } |
1008 | |
1009 | |
1009 | static inline unsigned long |
1010 | static inline unsigned long |
1010 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
1011 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
1011 | { |
1012 | { |
… | |
… | |
1446 | if (render_image (background_flags)) |
1447 | if (render_image (background_flags)) |
1447 | flags = flags & ~isInvalid; |
1448 | flags = flags & ~isInvalid; |
1448 | } |
1449 | } |
1449 | # endif |
1450 | # endif |
1450 | |
1451 | |
|
|
1452 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XRENDER |
1451 | XImage *result = NULL; |
1453 | XImage *result = NULL; |
1452 | |
1454 | |
1453 | if (background_flags && (flags & isInvalid)) |
1455 | if (background_flags && (flags & isInvalid)) |
1454 | { |
1456 | { |
1455 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1457 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1456 | } |
1458 | } |
1457 | |
1459 | |
1458 | if (result) |
1460 | if (result) |
1459 | { |
1461 | { |
1460 | # if !defined(HAVE_AFTERIMAGE) && !XRENDER |
|
|
1461 | /* our own client-side tinting */ |
1462 | /* our own client-side tinting */ |
1462 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1463 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1463 | { |
1464 | { |
1464 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1465 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1465 | if (flags & tintSet) |
1466 | if (flags & tintSet) |
1466 | tint.get (c); |
1467 | tint.get (c); |
1467 | ShadeXImage (DefaultVisual (target->dpy, target->display->screen), result, shade, c.r, c.g, c.b); |
1468 | ShadeXImage (DefaultVisual (target->dpy, target->display->screen), result, shade, c.r, c.g, c.b); |
1468 | } |
1469 | } |
1469 | # endif |
|
|
1470 | |
1470 | |
1471 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
1471 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
1472 | |
1472 | |
1473 | if (gc) |
1473 | if (gc) |
1474 | { |
1474 | { |
… | |
… | |
1478 | flags = flags & ~isInvalid; |
1478 | flags = flags & ~isInvalid; |
1479 | } |
1479 | } |
1480 | |
1480 | |
1481 | XDestroyImage (result); |
1481 | XDestroyImage (result); |
1482 | } |
1482 | } |
|
|
1483 | # endif |
1483 | |
1484 | |
1484 | if (flags & isInvalid) |
1485 | if (flags & isInvalid) |
1485 | { |
1486 | { |
1486 | if (pixmap != None) |
1487 | if (pixmap != None) |
1487 | { |
1488 | { |