… | |
… | |
328 | |
328 | |
329 | #endif /* XPM_BACKGROUND */ |
329 | #endif /* XPM_BACKGROUND */ |
330 | #endif /* HAVE_BG_PIXMAP */ |
330 | #endif /* HAVE_BG_PIXMAP */ |
331 | |
331 | |
332 | #ifdef ENABLE_TRANSPARENCY |
332 | #ifdef ENABLE_TRANSPARENCY |
333 | #if TINTING && !defined(HAVE_AFTERIMAGE) |
333 | #ifndef HAVE_AFTERIMAGE |
334 | /* taken from aterm-0.4.2 */ |
334 | /* taken from aterm-0.4.2 */ |
335 | |
335 | |
336 | typedef uint32_t RUINT32T; |
336 | typedef uint32_t RUINT32T; |
337 | |
337 | |
338 | static void |
338 | static void |
… | |
… | |
646 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
646 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
647 | &nitems, &bytes_after, &prop) == Success); |
647 | &nitems, &bytes_after, &prop) == Success); |
648 | |
648 | |
649 | /* TODO: the below logic needs to be cleaned up */ |
649 | /* TODO: the below logic needs to be cleaned up */ |
650 | if (!i || prop == NULL |
650 | if (!i || prop == NULL |
651 | #if TINTING |
|
|
652 | || (!ISSET_PIXCOLOR (Color_tint) && rs[Rs_shade] == NULL |
651 | || (!ISSET_PIXCOLOR (Color_tint) && rs[Rs_shade] == NULL |
653 | #ifdef HAVE_AFTERIMAGE |
652 | #ifdef HAVE_AFTERIMAGE |
654 | && bgPixmap.original_asim == NULL && rs[Rs_blurradius] == NULL |
653 | && bgPixmap.original_asim == NULL && rs[Rs_blurradius] == NULL |
655 | #endif |
654 | #endif |
656 | ) |
655 | ) |
657 | #endif |
|
|
658 | ) |
656 | ) |
659 | rootpixmap = None; |
657 | rootpixmap = None; |
660 | else |
658 | else |
661 | { |
659 | { |
662 | int junk; |
660 | int junk; |
… | |
… | |
682 | Bool whole_tint = False, no_tint = True; |
680 | Bool whole_tint = False, no_tint = True; |
683 | |
681 | |
684 | while (sx < 0) sx += (int)wrootattr.width; |
682 | while (sx < 0) sx += (int)wrootattr.width; |
685 | while (sy < 0) sy += (int)wrootattr.height; |
683 | while (sy < 0) sy += (int)wrootattr.height; |
686 | |
684 | |
687 | #if TINTING |
|
|
688 | if (rs[Rs_shade]) |
685 | if (rs[Rs_shade]) |
689 | shade = atoi (rs[Rs_shade]); |
686 | shade = atoi (rs[Rs_shade]); |
690 | if (ISSET_PIXCOLOR (Color_tint)) |
687 | if (ISSET_PIXCOLOR (Color_tint)) |
691 | pix_colors_focused [Color_tint].get (c); |
688 | pix_colors_focused [Color_tint].get (c); |
692 | #define IS_COMPONENT_WHOLESOME(c) ((c) <=0x000700 || (c)>=0x00f700) |
689 | #define IS_COMPONENT_WHOLESOME(c) ((c) <=0x000700 || (c)>=0x00f700) |
… | |
… | |
694 | whole_tint = (IS_COMPONENT_WHOLESOME(c.r) |
691 | whole_tint = (IS_COMPONENT_WHOLESOME(c.r) |
695 | && IS_COMPONENT_WHOLESOME(c.g) |
692 | && IS_COMPONENT_WHOLESOME(c.g) |
696 | && IS_COMPONENT_WHOLESOME(c.b)); |
693 | && IS_COMPONENT_WHOLESOME(c.b)); |
697 | no_tint = (c.r >= 0x00f700 && c.g >= 0x00f700 && c.b >= 0x00f700); |
694 | no_tint = (c.r >= 0x00f700 && c.g >= 0x00f700 && c.b >= 0x00f700); |
698 | #undef IS_COMPONENT_WHOLESOME |
695 | #undef IS_COMPONENT_WHOLESOME |
699 | #endif /* TINTING */ |
|
|
700 | /* theer are no performance advantages to reusing same pixmap */ |
696 | /* theer are no performance advantages to reusing same pixmap */ |
701 | if (bgPixmap.pixmap != None) |
697 | if (bgPixmap.pixmap != None) |
702 | XFreePixmap (dpy, bgPixmap.pixmap); |
698 | XFreePixmap (dpy, bgPixmap.pixmap); |
703 | bgPixmap.pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, rootdepth); |
699 | bgPixmap.pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, rootdepth); |
704 | bgPixmap.pmap_width = szHint.width; |
700 | bgPixmap.pmap_width = szHint.width; |
… | |
… | |
719 | gcvalue.ts_x_origin = -sx; |
715 | gcvalue.ts_x_origin = -sx; |
720 | gcvalue.ts_y_origin = -sy; |
716 | gcvalue.ts_y_origin = -sy; |
721 | gc = XCreateGC (dpy, rootpixmap, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcvalue); |
717 | gc = XCreateGC (dpy, rootpixmap, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcvalue); |
722 | XFillRectangle (dpy, bgPixmap.pixmap, gc, 0, 0, szHint.width, szHint.height); |
718 | XFillRectangle (dpy, bgPixmap.pixmap, gc, 0, 0, szHint.width, szHint.height); |
723 | |
719 | |
724 | #if TINTING |
|
|
725 | if (whole_tint && !no_tint) |
720 | if (whole_tint && !no_tint) |
726 | { |
721 | { |
727 | /* In this case we can tint image server-side getting significant |
722 | /* In this case we can tint image server-side getting significant |
728 | * performance improvements, as we eliminate XImage transfer |
723 | * performance improvements, as we eliminate XImage transfer |
729 | */ |
724 | */ |
… | |
… | |
731 | gcvalue.function = GXand; |
726 | gcvalue.function = GXand; |
732 | gcvalue.fill_style = FillSolid; |
727 | gcvalue.fill_style = FillSolid; |
733 | XChangeGC (dpy, gc, GCFillStyle | GCForeground | GCFunction, &gcvalue); |
728 | XChangeGC (dpy, gc, GCFillStyle | GCForeground | GCFunction, &gcvalue); |
734 | XFillRectangle (dpy, bgPixmap.pixmap, gc, 0, 0, szHint.width, szHint.height); |
729 | XFillRectangle (dpy, bgPixmap.pixmap, gc, 0, 0, szHint.width, szHint.height); |
735 | } |
730 | } |
736 | #endif |
|
|
737 | success = True; |
731 | success = True; |
738 | #ifdef HAVE_AFTERIMAGE |
732 | #ifdef HAVE_AFTERIMAGE |
739 | if (rs[Rs_blurradius] || bgPixmap.original_asim != NULL || (!whole_tint && (!no_tint || shade !=100))) |
733 | if (rs[Rs_blurradius] || bgPixmap.original_asim != NULL || (!whole_tint && (!no_tint || shade !=100))) |
740 | { |
734 | { |
741 | ARGB32 tint = TINT_LEAVE_SAME; |
735 | ARGB32 tint = TINT_LEAVE_SAME; |
… | |
… | |
836 | } /* back_im != NULL */ |
830 | } /* back_im != NULL */ |
837 | else |
831 | else |
838 | success = False; |
832 | success = False; |
839 | } |
833 | } |
840 | #else /* HAVE_AFTERIMAGE */ |
834 | #else /* HAVE_AFTERIMAGE */ |
841 | #if TINTING |
|
|
842 | if (!whole_tint && (!no_tint || shade !=100)) |
835 | if (!whole_tint && (!no_tint || shade !=100)) |
843 | { |
836 | { |
844 | XImage *image = XGetImage (dpy, bgPixmap.pixmap, 0, 0, szHint.width, szHint.height, AllPlanes, ZPixmap); |
837 | XImage *image = XGetImage (dpy, bgPixmap.pixmap, 0, 0, szHint.width, szHint.height, AllPlanes, ZPixmap); |
845 | success = False; |
838 | success = False; |
846 | if (image != NULL) |
839 | if (image != NULL) |
… | |
… | |
853 | XPutImage (dpy, bgPixmap.pixmap, gc, image, 0, 0, 0, 0, image->width, image->height); |
846 | XPutImage (dpy, bgPixmap.pixmap, gc, image, 0, 0, 0, 0, image->width, image->height); |
854 | XDestroyImage (image); |
847 | XDestroyImage (image); |
855 | success = True; |
848 | success = True; |
856 | } |
849 | } |
857 | } |
850 | } |
858 | #endif |
|
|
859 | #endif /* HAVE_AFTERIMAGE */ |
851 | #endif /* HAVE_AFTERIMAGE */ |
860 | PRINT_BACKGROUND_OP_TIME; |
852 | PRINT_BACKGROUND_OP_TIME; |
861 | |
853 | |
862 | if (gc != NULL) |
854 | if (gc != NULL) |
863 | XFreeGC (dpy, gc); |
855 | XFreeGC (dpy, gc); |