… | |
… | |
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
24 | *---------------------------------------------------------------------*/ |
24 | *---------------------------------------------------------------------*/ |
25 | |
25 | |
26 | #include "../config.h" /* NECESSARY */ |
26 | #include "../config.h" /* NECESSARY */ |
27 | #include "rxvt.h" /* NECESSARY */ |
27 | #include "rxvt.h" /* NECESSARY */ |
|
|
28 | |
|
|
29 | #define DO_TIMING_TEST 0 |
|
|
30 | |
|
|
31 | #if DO_TIMING_TEST |
|
|
32 | #define TIMING_TEST_START(id) \ |
|
|
33 | struct timeval timing_test_##id##_stv;\ |
|
|
34 | gettimeofday (&timing_test_##id##_stv, NULL); |
|
|
35 | |
|
|
36 | #define TIMING_TEST_PRINT_RESULT(id) \ |
|
|
37 | do{ struct timeval tv;gettimeofday (&tv, NULL); tv.tv_sec -= (timing_test_##id##_stv).tv_sec;\ |
|
|
38 | fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__,\ |
|
|
39 | tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec);}while (0) |
|
|
40 | |
|
|
41 | #else |
|
|
42 | #define TIMING_TEST_START(id) do{}while (0) |
|
|
43 | #define TIMING_TEST_PRINT_RESULT(id) do{}while (0) |
|
|
44 | #endif |
28 | |
45 | |
29 | /* |
46 | /* |
30 | * Pixmap geometry string interpretation : |
47 | * Pixmap geometry string interpretation : |
31 | * Each geometry string contains zero or one scale/position |
48 | * Each geometry string contains zero or one scale/position |
32 | * adjustment and may optionally be followed by a colon and one or more |
49 | * adjustment and may optionally be followed by a colon and one or more |
… | |
… | |
77 | # ifdef XPM_BACKGROUND |
94 | # ifdef XPM_BACKGROUND |
78 | # ifdef HAVE_AFTERIMAGE |
95 | # ifdef HAVE_AFTERIMAGE |
79 | if (original_asim != NULL) |
96 | if (original_asim != NULL) |
80 | # endif |
97 | # endif |
81 | { |
98 | { |
82 | if (h_scale != 0 || v_scale != 0) |
99 | if (h_scale != 0 || v_scale != 0 |
|
|
100 | || h_align != 0 || v_align != 0) |
83 | return true; |
101 | return true; |
84 | } |
102 | } |
85 | # endif |
103 | # endif |
86 | # ifdef ENABLE_TRANSPARENCY |
104 | # ifdef ENABLE_TRANSPARENCY |
87 | if (flags & isTransparent) |
105 | if (flags & isTransparent) |
88 | return true; |
106 | return true; |
|
|
107 | # endif |
|
|
108 | return false; |
|
|
109 | } |
|
|
110 | |
|
|
111 | bool bgPixmap_t::need_client_side_rendering () |
|
|
112 | { |
|
|
113 | # ifdef HAVE_AFTERIMAGE |
|
|
114 | if (original_asim != NULL) |
|
|
115 | return true; |
|
|
116 | # endif |
|
|
117 | # ifdef ENABLE_TRANSPARENCY |
|
|
118 | if (flags & isTransparent) |
|
|
119 | { |
|
|
120 | if (((flags & blurNeeded) && !(flags & blurServerSide)) |
|
|
121 | || ((flags & tintNeeded) && !(flags & tintServerSide))) |
|
|
122 | return true; |
|
|
123 | } |
89 | # endif |
124 | # endif |
90 | return false; |
125 | return false; |
91 | } |
126 | } |
92 | |
127 | |
93 | # ifdef XPM_BACKGROUND |
128 | # ifdef XPM_BACKGROUND |
… | |
… | |
359 | int x = 0; |
394 | int x = 0; |
360 | int y = 0; |
395 | int y = 0; |
361 | int w = h_scale * target_width / 100; |
396 | int w = h_scale * target_width / 100; |
362 | int h = v_scale * target_height / 100; |
397 | int h = v_scale * target_height / 100; |
363 | |
398 | |
|
|
399 | TIMING_TEST_START (asim); |
|
|
400 | |
364 | if (original_asim) |
401 | if (original_asim) |
365 | { |
402 | { |
366 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
403 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
367 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
404 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
368 | } |
405 | } |
… | |
… | |
472 | result = tmp; |
509 | result = tmp; |
473 | } |
510 | } |
474 | free (layers); |
511 | free (layers); |
475 | } |
512 | } |
476 | } |
513 | } |
|
|
514 | TIMING_TEST_PRINT_RESULT (asim); |
477 | |
515 | |
478 | if (pixmap) |
516 | if (pixmap) |
479 | { |
517 | { |
480 | if (result == NULL |
518 | if (result == NULL |
481 | || pmap_width != new_pmap_width |
519 | || pmap_width != new_pmap_width |
… | |
… | |
527 | |
565 | |
528 | if (result != background && result != original_asim) |
566 | if (result != background && result != original_asim) |
529 | destroy_asimage (&result); |
567 | destroy_asimage (&result); |
530 | |
568 | |
531 | XFreeGC (target->dpy, gc); |
569 | XFreeGC (target->dpy, gc); |
|
|
570 | TIMING_TEST_PRINT_RESULT (asim); |
532 | } |
571 | } |
533 | |
572 | |
534 | return true; |
573 | return true; |
535 | } |
574 | } |
536 | # endif /* HAVE_AFTERIMAGE */ |
575 | # endif /* HAVE_AFTERIMAGE */ |
… | |
… | |
544 | |
583 | |
545 | if (*file != '\0') |
584 | if (*file != '\0') |
546 | { |
585 | { |
547 | # ifdef HAVE_AFTERIMAGE |
586 | # ifdef HAVE_AFTERIMAGE |
548 | if (target->asimman == NULL) |
587 | if (target->asimman == NULL) |
549 | target->asimman = create_generic_imageman(target->rs[Rs_path]); |
588 | target->asimman = create_generic_imageman (target->rs[Rs_path]); |
550 | if ((f = strchr (file, ';')) == NULL) |
589 | if ((f = strchr (file, ';')) == NULL) |
551 | original_asim = get_asimage( target->asimman, file, 0xFFFFFFFF, 100 ); |
590 | original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); |
552 | else |
591 | else |
553 | { |
592 | { |
554 | size_t len = f - file; |
593 | size_t len = f - file; |
555 | f = (char *)malloc (len + 1); |
594 | f = (char *)malloc (len + 1); |
556 | strncpy (f, file, len); |
595 | strncpy (f, file, len); |
557 | f[len] = '\0'; |
596 | f[len] = '\0'; |
558 | original_asim = get_asimage( target->asimman, f, 0xFFFFFFFF, 100 ); |
597 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
559 | free( f ); |
598 | free (f); |
560 | } |
599 | } |
561 | return (original_asim != NULL); |
600 | return (original_asim != NULL); |
562 | # endif |
601 | # endif |
563 | } |
602 | } |
564 | return false; |
603 | return false; |
… | |
… | |
573 | if (!(flags & isTransparent)) |
612 | if (!(flags & isTransparent)) |
574 | { |
613 | { |
575 | flags |= isTransparent; |
614 | flags |= isTransparent; |
576 | return true; |
615 | return true; |
577 | } |
616 | } |
|
|
617 | return false; |
578 | } |
618 | } |
579 | |
619 | |
580 | bool |
620 | bool |
581 | bgPixmap_t::set_blur_radius (const char *geom) |
621 | bgPixmap_t::set_blur_radius (const char *geom) |
582 | { |
622 | { |
583 | int changed = 0; |
623 | int changed = 0; |
584 | unsigned int hr, vr; |
624 | unsigned int hr, vr; |
585 | int junk; |
625 | int junk; |
586 | int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); |
626 | int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); |
|
|
627 | |
587 | if (!(geom_flags&WidthValue)) |
628 | if (!(geom_flags&WidthValue)) |
588 | hr = 1; |
629 | hr = 1; |
589 | if (!(geom_flags&HeightValue)) |
630 | if (!(geom_flags&HeightValue)) |
590 | vr = hr; |
631 | vr = hr; |
591 | |
632 | |
592 | if (h_blurRadius != hr) |
633 | if (h_blurRadius != hr) |
593 | { |
634 | { |
594 | ++changed; |
635 | ++changed; |
595 | h_blurRadius = hr; |
636 | h_blurRadius = hr; |
596 | } |
637 | } |
|
|
638 | |
597 | if (v_blurRadius != vr) |
639 | if (v_blurRadius != vr) |
598 | { |
640 | { |
599 | ++changed; |
641 | ++changed; |
600 | v_blurRadius = vr; |
642 | v_blurRadius = vr; |
601 | } |
643 | } |
|
|
644 | |
|
|
645 | if (v_blurRadius == 0 && h_blurRadius == 0) |
|
|
646 | flags &= ~blurNeeded; |
|
|
647 | else |
|
|
648 | flags |= blurNeeded; |
|
|
649 | |
602 | return (changed>0); |
650 | return (changed>0); |
603 | } |
651 | } |
604 | |
652 | |
605 | static inline unsigned long |
653 | static inline unsigned long |
606 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
654 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
607 | { |
655 | { |
608 | unsigned long flags = 0; |
656 | unsigned long flags = 0; |
|
|
657 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
609 | |
658 | |
610 | if (shade > 0 && shade <100) |
659 | if (tint) |
|
|
660 | { |
|
|
661 | tint->get (c); |
|
|
662 | # define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700) |
|
|
663 | if (IS_COMPONENT_WHOLESOME (c.r) |
|
|
664 | && IS_COMPONENT_WHOLESOME (c.g) |
|
|
665 | && IS_COMPONENT_WHOLESOME (c.b)) |
|
|
666 | flags |= bgPixmap_t::tintWholesome; |
|
|
667 | # undef IS_COMPONENT_WHOLESOME |
|
|
668 | } |
|
|
669 | |
|
|
670 | if ((shade > 0 && shade < 100) || (shade > 100 && shade < 200)) |
611 | flags |= bgPixmap_t::tintNeeded; |
671 | flags |= bgPixmap_t::tintNeeded; |
612 | else if (tint) |
672 | else if (tint) |
613 | { |
673 | { |
614 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
615 | tint->get (c); |
|
|
616 | |
|
|
617 | flags |= bgPixmap_t::tintNeeded; |
|
|
618 | if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700) |
674 | if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700) |
619 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
675 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
620 | { |
676 | { |
621 | flags |= bgPixmap_t::tintNeeded; |
677 | flags |= bgPixmap_t::tintNeeded; |
622 | #define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700) |
|
|
623 | if (IS_COMPONENT_WHOLESOME (c.r) |
|
|
624 | && IS_COMPONENT_WHOLESOME (c.g) |
|
|
625 | && IS_COMPONENT_WHOLESOME (c.b)) |
|
|
626 | flags |= bgPixmap_t::tintServerSide; |
|
|
627 | #undef IS_COMPONENT_WHOLESOME |
|
|
628 | } |
678 | } |
629 | } |
679 | } |
|
|
680 | |
|
|
681 | if (flags & bgPixmap_t::tintNeeded) |
|
|
682 | { |
|
|
683 | if (flags & bgPixmap_t::tintWholesome) |
|
|
684 | flags |= bgPixmap_t::tintServerSide; |
|
|
685 | #if XFT |
|
|
686 | flags |= bgPixmap_t::tintServerSide; |
|
|
687 | #endif |
|
|
688 | } |
|
|
689 | |
630 | return flags; |
690 | return flags; |
631 | } |
691 | } |
632 | |
692 | |
633 | bool |
693 | bool |
634 | bgPixmap_t::set_tint (rxvt_color &new_tint) |
694 | bgPixmap_t::set_tint (rxvt_color &new_tint) |
… | |
… | |
664 | if (new_shade == 100) |
724 | if (new_shade == 100) |
665 | new_shade = 0; |
725 | new_shade = 0; |
666 | |
726 | |
667 | if (new_shade != shade) |
727 | if (new_shade != shade) |
668 | { |
728 | { |
669 | unsigned long new_flags = compute_tint_shade_flags (&tint, new_shade); |
729 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
670 | shade = new_shade; |
730 | shade = new_shade; |
671 | flags = (flags & ~tintFlags) | new_flags; |
731 | flags = (flags & ~tintFlags) | new_flags; |
672 | return true; |
732 | return true; |
673 | } |
733 | } |
674 | return false; |
734 | return false; |
675 | } |
735 | } |
676 | |
|
|
677 | |
736 | |
678 | /* make_transparency_pixmap() |
737 | /* make_transparency_pixmap() |
679 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
738 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
680 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
739 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
681 | * our window. |
740 | * our window. |
… | |
… | |
700 | int window_width = target->szHint.width; |
759 | int window_width = target->szHint.width; |
701 | int window_height = target->szHint.height; |
760 | int window_height = target->szHint.height; |
702 | int sx, sy; |
761 | int sx, sy; |
703 | XGCValues gcv; |
762 | XGCValues gcv; |
704 | |
763 | |
|
|
764 | TIMING_TEST_START (tp); |
705 | target->get_window_origin (sx, sy); |
765 | target->get_window_origin (sx, sy); |
706 | |
766 | |
707 | /* check if we are outside of the visible part of the virtual screen : */ |
767 | /* check if we are outside of the visible part of the virtual screen : */ |
708 | if (sx + window_width <= 0 || sy + window_height <= 0 |
768 | if (sx + window_width <= 0 || sy + window_height <= 0 |
709 | || sx >= root_width || sy >= root_height) |
769 | || sx >= root_width || sy >= root_height) |
… | |
… | |
713 | {/* we want to validate the pixmap and get it's size at the same time : */ |
773 | {/* we want to validate the pixmap and get it's size at the same time : */ |
714 | int junk; |
774 | int junk; |
715 | unsigned int ujunk; |
775 | unsigned int ujunk; |
716 | /* root pixmap may be bad - allow a error */ |
776 | /* root pixmap may be bad - allow a error */ |
717 | target->allowedxerror = -1; |
777 | target->allowedxerror = -1; |
|
|
778 | |
718 | if (!XGetGeometry (dpy, root_pixmap, &root, &junk, &junk, &root_pmap_width, &root_pmap_height, &ujunk, &ujunk)) |
779 | if (!XGetGeometry (dpy, root_pixmap, &root, &junk, &junk, &root_pmap_width, &root_pmap_height, &ujunk, &ujunk)) |
719 | root_pixmap = None; |
780 | root_pixmap = None; |
|
|
781 | |
720 | target->allowedxerror = 0; |
782 | target->allowedxerror = 0; |
721 | } |
783 | } |
722 | |
784 | |
723 | Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); |
785 | Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); |
724 | GC gc = NULL; |
786 | GC gc = NULL; |
… | |
… | |
748 | XEvent event; |
810 | XEvent event; |
749 | int ev_count = 0; |
811 | int ev_count = 0; |
750 | XGrabServer (dpy); |
812 | XGrabServer (dpy); |
751 | XMapRaised (dpy, src); |
813 | XMapRaised (dpy, src); |
752 | XSync (dpy, False); |
814 | XSync (dpy, False); |
|
|
815 | |
753 | /* XSync should get window where it's properly exposed, |
816 | /* XSync should get window where it's properly exposed, |
754 | * but to be on the safe side - let's check for the actuall event to arrive : */ |
817 | * but to be on the safe side - let's check for the actuall event to arrive : */ |
755 | while (XCheckWindowEvent (dpy, src, ExposureMask, &event)) |
818 | while (XCheckWindowEvent (dpy, src, ExposureMask, &event)) |
756 | ++ev_count; |
819 | ++ev_count; |
|
|
820 | |
757 | if (ev_count > 0); |
821 | if (ev_count > 0); |
758 | { /* hooray! - we can grab the image! */ |
822 | { /* hooray! - we can grab the image! */ |
759 | gc = XCreateGC (dpy, root, 0, NULL); |
823 | gc = XCreateGC (dpy, root, 0, NULL); |
760 | if (gc) |
824 | if (gc) |
761 | { |
825 | { |
… | |
… | |
765 | } |
829 | } |
766 | XDestroyWindow (dpy, src); |
830 | XDestroyWindow (dpy, src); |
767 | XUngrabServer (dpy); |
831 | XUngrabServer (dpy); |
768 | //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count); |
832 | //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count); |
769 | } |
833 | } |
|
|
834 | |
770 | if (!success) |
835 | if (!success) |
771 | { |
836 | { |
772 | XFreePixmap (dpy, tiled_root_pmap); |
837 | XFreePixmap (dpy, tiled_root_pmap); |
773 | tiled_root_pmap = None; |
838 | tiled_root_pmap = None; |
774 | } |
839 | } |
… | |
… | |
777 | } |
842 | } |
778 | else |
843 | else |
779 | {/* strightforward pixmap copy */ |
844 | {/* strightforward pixmap copy */ |
780 | gcv.tile = root_pixmap; |
845 | gcv.tile = root_pixmap; |
781 | gcv.fill_style = FillTiled; |
846 | gcv.fill_style = FillTiled; |
|
|
847 | |
782 | while (sx < 0) sx += (int)window_width; |
848 | while (sx < 0) sx += (int)window_width; |
783 | while (sy < 0) sy += (int)window_height; |
849 | while (sy < 0) sy += (int)window_height; |
|
|
850 | |
784 | gcv.ts_x_origin = -sx; |
851 | gcv.ts_x_origin = -sx; |
785 | gcv.ts_y_origin = -sy; |
852 | gcv.ts_y_origin = -sy; |
786 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
853 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
|
|
854 | |
787 | if (gc) |
855 | if (gc) |
788 | { |
856 | { |
789 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
857 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
790 | result |= transpPmapTiled; |
858 | result |= transpPmapTiled; |
791 | } |
859 | } |
792 | } |
860 | } |
|
|
861 | TIMING_TEST_PRINT_RESULT (tp); |
793 | |
862 | |
794 | if (tiled_root_pmap != None) |
863 | if (tiled_root_pmap != None) |
|
|
864 | { |
|
|
865 | if (!need_client_side_rendering ()) |
795 | { |
866 | { |
796 | if (flags & tintNeeded) |
867 | if ((flags & tintNeeded)) |
797 | { |
868 | { |
798 | if ((flags & tintServerSide) |
869 | if (flags & tintWholesome) |
799 | && h_blurRadius <= 1 && v_blurRadius <= 1 |
|
|
800 | # ifdef HAVE_AFTERIMAGE |
|
|
801 | && original_asim == NULL |
|
|
802 | # endif |
|
|
803 | ) |
870 | { |
804 | { /* In this case we can tint image server-side getting significant |
871 | /* In this case we can tint image server-side getting significant |
805 | * performance improvements, as we eliminate XImage transfer |
872 | * performance improvements, as we eliminate XImage transfer |
806 | */ |
873 | */ |
807 | gcv.foreground = Pixel (tint); |
874 | gcv.foreground = Pixel (tint); |
808 | gcv.function = GXand; |
875 | gcv.function = GXand; |
809 | gcv.fill_style = FillSolid; |
876 | gcv.fill_style = FillSolid; |
810 | if (gc) |
877 | if (gc) |
811 | XChangeGC (dpy, gc, GCFillStyle | GCForeground | GCFunction, &gcv); |
878 | XChangeGC (dpy, gc, GCFillStyle | GCForeground | GCFunction, &gcv); |
812 | else |
879 | else |
813 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
880 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
814 | if (gc) |
881 | if (gc) |
815 | { |
882 | { |
816 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
883 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
817 | result |= transpPmapTinted; |
884 | result |= transpPmapTinted; |
818 | } |
885 | } |
|
|
886 | } |
|
|
887 | else |
|
|
888 | { |
|
|
889 | # if XFT |
|
|
890 | Picture back_pic = 0; |
|
|
891 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
892 | |
|
|
893 | if (flags & tintSet) |
|
|
894 | tint.get (c); |
|
|
895 | |
|
|
896 | if (shade > 0 && shade < 100) |
|
|
897 | { |
|
|
898 | c.r = (c.r * shade) / 100; |
|
|
899 | c.g = (c.g * shade) / 100; |
|
|
900 | c.b = (c.b * shade) / 100; |
|
|
901 | } |
|
|
902 | else if( shade > 100 && shade < 200) |
|
|
903 | { |
|
|
904 | c.r = (c.r * (200 - shade)) / 100; |
|
|
905 | c.g = (c.g * (200 - shade)) / 100; |
|
|
906 | c.b = (c.b * (200 - shade)) / 100; |
|
|
907 | } |
|
|
908 | |
|
|
909 | XRenderPictFormat pf; |
|
|
910 | pf.type = PictTypeDirect; |
|
|
911 | pf.depth = 32; |
|
|
912 | pf.direct.redMask = 0xff; |
|
|
913 | pf.direct.greenMask = 0xff; |
|
|
914 | pf.direct.blueMask = 0xff; |
|
|
915 | pf.direct.alphaMask = 0xff; |
|
|
916 | |
|
|
917 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
|
|
918 | (PictFormatType| |
|
|
919 | PictFormatDepth| |
|
|
920 | PictFormatRedMask| |
|
|
921 | PictFormatGreenMask| |
|
|
922 | PictFormatBlueMask| |
|
|
923 | PictFormatAlphaMask), |
|
|
924 | &pf, |
|
|
925 | 0); |
|
|
926 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
|
|
927 | XRenderPictureAttributes pa ; |
|
|
928 | |
|
|
929 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
|
|
930 | |
|
|
931 | pa.repeat = True; |
|
|
932 | |
|
|
933 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
|
|
934 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
|
|
935 | XFreePixmap (dpy, overlay_pmap); |
|
|
936 | |
|
|
937 | pa.component_alpha = True; |
|
|
938 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
|
|
939 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
|
|
940 | XFreePixmap (dpy, mask_pmap); |
|
|
941 | |
|
|
942 | if (mask_pic && overlay_pic && back_pic) |
|
|
943 | { |
|
|
944 | XRenderColor mask_c; |
|
|
945 | |
|
|
946 | memset (&mask_c, (shade > 100) ? 0xFF : 0x0, sizeof (mask_c)); |
|
|
947 | mask_c.alpha = 0xffff; |
|
|
948 | XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); |
|
|
949 | memset (&mask_c, 0x0, sizeof (mask_c)); |
|
|
950 | mask_c.alpha = 0; |
|
|
951 | |
|
|
952 | if (c.r == c.b && c.b == c.g) /* pure shading */ |
|
|
953 | { |
|
|
954 | mask_c.red = mask_c.green = mask_c.blue = 0xffff - c.r; |
|
|
955 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
956 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
|
|
957 | } |
|
|
958 | else |
|
|
959 | { |
|
|
960 | mask_c.red = 0xffff - c.r; |
|
|
961 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
962 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
|
|
963 | mask_c.red = 0; |
|
|
964 | mask_c.green = 0xffff - c.g; |
|
|
965 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
966 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
|
|
967 | mask_c.green = 0; |
|
|
968 | mask_c.blue = 0xffff - c.b; |
|
|
969 | XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); |
|
|
970 | XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); |
|
|
971 | } |
|
|
972 | result |= transpPmapTinted; |
|
|
973 | } |
|
|
974 | XRenderFreePicture (dpy, mask_pic); |
|
|
975 | XRenderFreePicture (dpy, overlay_pic); |
|
|
976 | XRenderFreePicture (dpy, back_pic); |
|
|
977 | # if DO_TIMING_TEST |
|
|
978 | XSync (dpy, False); |
|
|
979 | # endif |
|
|
980 | # endif |
|
|
981 | } |
819 | } |
982 | } |
820 | } |
983 | } /* server side rendering completed */ |
|
|
984 | |
821 | if (pixmap) |
985 | if (pixmap) |
822 | XFreePixmap (dpy, pixmap); |
986 | XFreePixmap (dpy, pixmap); |
|
|
987 | |
823 | pixmap = tiled_root_pmap; |
988 | pixmap = tiled_root_pmap; |
824 | pmap_width = window_width; |
989 | pmap_width = window_width; |
825 | pmap_height = window_height; |
990 | pmap_height = window_height; |
826 | pmap_depth = root_depth; |
991 | pmap_depth = root_depth; |
827 | } |
992 | } |
828 | |
993 | |
829 | if (gc) |
994 | if (gc) |
830 | XFreeGC (dpy, gc); |
995 | XFreeGC (dpy, gc); |
|
|
996 | |
|
|
997 | TIMING_TEST_PRINT_RESULT (tp); |
831 | |
998 | |
832 | return result; |
999 | return result; |
833 | } |
1000 | } |
834 | |
1001 | |
835 | bool |
1002 | bool |
836 | bgPixmap_t::set_root_pixmap () |
1003 | bgPixmap_t::set_root_pixmap () |
837 | { |
1004 | { |
… | |
… | |
850 | } |
1017 | } |
851 | # endif /* ENABLE_TRANSPARENCY */ |
1018 | # endif /* ENABLE_TRANSPARENCY */ |
852 | |
1019 | |
853 | # ifndef HAVE_AFTERIMAGE |
1020 | # ifndef HAVE_AFTERIMAGE |
854 | static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); |
1021 | static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); |
855 | #endif |
1022 | # endif |
856 | |
1023 | |
857 | |
1024 | |
858 | bool |
1025 | bool |
859 | bgPixmap_t::render () |
1026 | bgPixmap_t::render () |
860 | { |
1027 | { |
… | |
… | |
885 | ASImage *background = NULL; |
1052 | ASImage *background = NULL; |
886 | ARGB32 as_tint = TINT_LEAVE_SAME; |
1053 | ARGB32 as_tint = TINT_LEAVE_SAME; |
887 | if (background_flags) |
1054 | if (background_flags) |
888 | background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); |
1055 | background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); |
889 | |
1056 | |
|
|
1057 | # ifdef ENABLE_TRANSPARENCY |
890 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1058 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
891 | { |
1059 | { |
892 | ShadingInfo as_shade; |
1060 | ShadingInfo as_shade; |
893 | as_shade.shading = (shade == 0) ? 100 : shade; |
1061 | as_shade.shading = (shade == 0) ? 100 : shade; |
894 | |
1062 | |
… | |
… | |
899 | as_shade.tintColor.green = c.g; |
1067 | as_shade.tintColor.green = c.g; |
900 | as_shade.tintColor.blue = c.b; |
1068 | as_shade.tintColor.blue = c.b; |
901 | |
1069 | |
902 | as_tint = shading2tint32 (&as_shade); |
1070 | as_tint = shading2tint32 (&as_shade); |
903 | } |
1071 | } |
|
|
1072 | if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL) |
|
|
1073 | { |
|
|
1074 | ASImage* tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
|
|
1075 | (original_asim == NULL || tint == TINT_LEAVE_SAME)?ASA_XImage:ASA_ASImage, |
|
|
1076 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
1077 | if (tmp) |
|
|
1078 | { |
|
|
1079 | destroy_asimage (&background); |
|
|
1080 | background = tmp; |
|
|
1081 | } |
|
|
1082 | } |
|
|
1083 | # endif |
|
|
1084 | |
904 | if (render_asim (background, as_tint)) |
1085 | if (render_asim (background, as_tint)) |
905 | flags = flags & ~isInvalid; |
1086 | flags = flags & ~isInvalid; |
906 | if (background) |
1087 | if (background) |
907 | destroy_asimage (&background); |
1088 | destroy_asimage (&background); |
908 | } |
1089 | } |
… | |
… | |
920 | if (flags & tintSet) |
1101 | if (flags & tintSet) |
921 | tint.get (c); |
1102 | tint.get (c); |
922 | ShadeXImage (target, result, shade, c.r, c.g, c.b); |
1103 | ShadeXImage (target, result, shade, c.r, c.g, c.b); |
923 | } |
1104 | } |
924 | } |
1105 | } |
925 | # endif |
1106 | # endif /* HAVE_AFTERIMAGE */ |
|
|
1107 | |
926 | if (result != NULL) |
1108 | if (result != NULL) |
927 | { |
1109 | { |
928 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
1110 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
929 | if (gc) |
1111 | if (gc) |
930 | { |
1112 | { |
931 | if (pmap_depth != target->depth && pixmap != None) |
1113 | if (/*pmap_depth != target->depth &&*/ pixmap != None) |
932 | { |
1114 | { |
933 | XFreePixmap (target->dpy, pixmap); |
1115 | XFreePixmap (target->dpy, pixmap); |
934 | pixmap = None; |
1116 | pixmap = None; |
935 | } |
1117 | } |
936 | if (pixmap == None) |
1118 | if (pixmap == None) |
… | |
… | |
938 | pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth); |
1120 | pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth); |
939 | pmap_width = result->width; |
1121 | pmap_width = result->width; |
940 | pmap_height = result->height; |
1122 | pmap_height = result->height; |
941 | pmap_depth = target->depth; |
1123 | pmap_depth = target->depth; |
942 | } |
1124 | } |
|
|
1125 | if (pmap_depth != result->depth) |
|
|
1126 | { /* Bad Match error will ensue ! stupid X !!!! */ |
|
|
1127 | if( result->depth == 24 && pmap_depth == 32) |
|
|
1128 | result->depth = 32; |
|
|
1129 | else if( result->depth == 32 && pmap_depth == 24) |
|
|
1130 | result->depth = 24; |
|
|
1131 | else |
|
|
1132 | { |
|
|
1133 | /* TODO: implement image recoding */ |
|
|
1134 | } |
|
|
1135 | } |
|
|
1136 | if (pmap_depth == result->depth) |
943 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1137 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
944 | XFreeGC (target->dpy, gc); |
1138 | XFreeGC (target->dpy, gc); |
945 | flags = flags & ~isInvalid; |
1139 | flags = flags & ~isInvalid; |
946 | } |
1140 | } |
947 | XDestroyImage (result); |
1141 | XDestroyImage (result); |
948 | } |
1142 | } |
… | |
… | |
952 | if (pixmap != None) |
1146 | if (pixmap != None) |
953 | { |
1147 | { |
954 | XFreePixmap (target->dpy, pixmap); |
1148 | XFreePixmap (target->dpy, pixmap); |
955 | pixmap = None; |
1149 | pixmap = None; |
956 | } |
1150 | } |
957 | // TODO : we need to get rid of that garbadge : |
|
|
958 | target->am_transparent = target->am_pixmap_trans = 0; |
|
|
959 | } |
1151 | } |
960 | else |
|
|
961 | target->am_transparent = target->am_pixmap_trans = 1; |
|
|
962 | |
1152 | |
963 | apply (); |
1153 | apply (); |
964 | |
1154 | |
965 | return true; |
1155 | return true; |
966 | } |
1156 | } |
… | |
… | |
983 | void |
1173 | void |
984 | bgPixmap_t::apply() |
1174 | bgPixmap_t::apply() |
985 | { |
1175 | { |
986 | if (target) |
1176 | if (target) |
987 | { |
1177 | { |
|
|
1178 | flags &= ~isVtOrigin; |
988 | if (pixmap != None) |
1179 | if (pixmap != None) |
989 | { /* set target's background to pixmap */ |
1180 | { /* set target's background to pixmap */ |
990 | # ifdef ENABLE_TRANSPARENCY |
1181 | # ifdef ENABLE_TRANSPARENCY |
991 | if (flags & isTransparent) |
1182 | if (flags & isTransparent) |
992 | { |
1183 | { |
… | |
… | |
998 | # endif |
1189 | # endif |
999 | } |
1190 | } |
1000 | else |
1191 | else |
1001 | # endif |
1192 | # endif |
1002 | { |
1193 | { |
|
|
1194 | flags |= isVtOrigin; |
1003 | /* force old pixmap dereference in case it was transparent before :*/ |
1195 | /* force old pixmap dereference in case it was transparent before :*/ |
1004 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
1196 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
1005 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
1197 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
1006 | /* do we also need to set scrollbar's background here ? */ |
1198 | /* do we also need to set scrollbar's background here ? */ |
1007 | # if HAVE_SCROLLBARS |
1199 | # if HAVE_SCROLLBARS |
… | |
… | |
1018 | # if HAVE_SCROLLBARS |
1210 | # if HAVE_SCROLLBARS |
1019 | if (target->scrollBar.win) |
1211 | if (target->scrollBar.win) |
1020 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1212 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1021 | # endif |
1213 | # endif |
1022 | } |
1214 | } |
|
|
1215 | |
1023 | /* don't want Expose on the parent */ |
1216 | /* don't want Expose on the parent */ |
1024 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); |
1217 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); |
1025 | /* do want Expose on the vt */ |
1218 | /* do want Expose on the vt, so we get refreshed properly */ |
1026 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, True); |
1219 | XClearArea (target->dpy, target->vt, 0, 0, 0, 0, True); |
|
|
1220 | |
1027 | #if HAVE_SCROLLBARS |
1221 | # if HAVE_SCROLLBARS |
1028 | if (target->scrollBar.win) |
1222 | if (target->scrollBar.win) |
1029 | { |
1223 | { |
1030 | target->scrollBar.setIdle (); |
1224 | target->scrollBar.setIdle (); |
1031 | target->scrollbar_show (0); |
1225 | target->scrollbar_show (0); |
1032 | } |
1226 | } |
1033 | #endif |
1227 | # endif |
1034 | /* Is that really neccessary? we did a XClearArea to generate Expose events alreday ! */ |
|
|
1035 | target->want_refresh = target->want_full_refresh = 1; |
|
|
1036 | /* TODO: why do we need a flush here ??? It causes segfault on resize ! */ |
|
|
1037 | // target->flush (); |
|
|
1038 | } |
1228 | } |
1039 | } |
1229 | } |
1040 | #endif /* HAVE_BG_PIXMAP */ |
|
|
1041 | |
|
|
1042 | |
1230 | |
1043 | void |
1231 | void |
1044 | rxvt_term::get_window_origin (int &x, int &y) |
1232 | rxvt_term::get_window_origin (int &x, int &y) |
1045 | { |
1233 | { |
1046 | Window cr; |
1234 | Window cr; |
1047 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
1235 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
|
|
1236 | /* fprintf( stderr, "origin is %+d%+d\n", x, y);*/ |
1048 | } |
1237 | } |
1049 | |
1238 | |
1050 | Pixmap |
1239 | Pixmap |
1051 | rxvt_term::get_pixmap_property (int prop_id) |
1240 | rxvt_term::get_pixmap_property (int prop_id) |
1052 | { |
1241 | { |
1053 | if (prop_id > 0 && prop_id < NUM_XA) |
1242 | if (prop_id > 0 && prop_id < NUM_XA) |
1054 | if (xa[prop_id]) |
1243 | if (xa[prop_id]) |
1055 | { |
1244 | { |
1056 | int aformat, rootdepth; |
1245 | int aformat; |
1057 | unsigned long nitems, bytes_after; |
1246 | unsigned long nitems, bytes_after; |
1058 | Atom atype; |
1247 | Atom atype; |
1059 | unsigned char *prop = NULL; |
1248 | unsigned char *prop = NULL; |
1060 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
1249 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
1061 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
1250 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
… | |
… | |
1066 | } |
1255 | } |
1067 | } |
1256 | } |
1068 | return None; |
1257 | return None; |
1069 | } |
1258 | } |
1070 | |
1259 | |
|
|
1260 | /* |
|
|
1261 | * Check our parents are still who we think they are. |
|
|
1262 | * Do transparency updates if required |
|
|
1263 | */ |
|
|
1264 | int |
|
|
1265 | rxvt_term::update_background () |
|
|
1266 | { |
|
|
1267 | bgPixmap.invalidate(); |
1071 | |
1268 | |
1072 | #ifdef ENABLE_TRANSPARENCY |
1269 | /* no chance of real time refresh if we are blurring ! */ |
1073 | #ifndef HAVE_AFTERIMAGE |
1270 | if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) |
|
|
1271 | bgPixmap.render(); |
|
|
1272 | else |
|
|
1273 | { |
|
|
1274 | update_background_ev.stop (); |
|
|
1275 | if (!bgPixmap.need_client_side_rendering()) |
|
|
1276 | update_background_ev.start (NOW + .05); |
|
|
1277 | else if (bgPixmap.flags & bgPixmap_t::blurNeeded) |
|
|
1278 | update_background_ev.start (NOW + .2); /* very slow !!! */ |
|
|
1279 | else |
|
|
1280 | update_background_ev.start (NOW + .07); |
|
|
1281 | } |
|
|
1282 | return 0; |
|
|
1283 | } |
|
|
1284 | |
|
|
1285 | void |
|
|
1286 | rxvt_term::update_background_cb (time_watcher &w) |
|
|
1287 | { |
|
|
1288 | bgPixmap.render (); |
|
|
1289 | } |
|
|
1290 | #endif /* HAVE_BG_PIXMAP */ |
|
|
1291 | |
|
|
1292 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1074 | /* taken from aterm-0.4.2 */ |
1293 | /* taken from aterm-0.4.2 */ |
1075 | |
1294 | |
1076 | typedef uint32_t RUINT32T; |
1295 | typedef uint32_t RUINT32T; |
1077 | |
1296 | |
1078 | static void |
1297 | static void |
… | |
… | |
1089 | |
1308 | |
1090 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return ; |
1309 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return ; |
1091 | |
1310 | |
1092 | if (shade == 0) |
1311 | if (shade == 0) |
1093 | shade = 100; |
1312 | shade = 100; |
1094 | |
1313 | |
1095 | /* for convenience */ |
1314 | /* for convenience */ |
1096 | mask_r = visual->red_mask; |
1315 | mask_r = visual->red_mask; |
1097 | mask_g = visual->green_mask; |
1316 | mask_g = visual->green_mask; |
1098 | mask_b = visual->blue_mask; |
1317 | mask_b = visual->blue_mask; |
1099 | |
1318 | |
… | |
… | |
1301 | } |
1520 | } |
1302 | } |
1521 | } |
1303 | |
1522 | |
1304 | free (lookup); |
1523 | free (lookup); |
1305 | } |
1524 | } |
1306 | #endif |
1525 | #endif /* defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) */ |
1307 | |
1526 | |
1308 | /* |
1527 | #if 0 /* replaced by a bgPixmap_t::render() - leve here temporarily for reference */ |
1309 | * Check our parents are still who we think they are. |
|
|
1310 | * Do transparency updates if required |
|
|
1311 | */ |
|
|
1312 | int |
|
|
1313 | rxvt_term::check_our_parents () |
|
|
1314 | { |
|
|
1315 | check_our_parents_ev.stop (); |
|
|
1316 | check_our_parents_ev.start (NOW + .1); |
|
|
1317 | return 0; |
|
|
1318 | } |
|
|
1319 | |
|
|
1320 | void |
1528 | void |
1321 | rxvt_term::check_our_parents_cb (time_watcher &w) |
1529 | rxvt_term::check_our_parents_cb (time_watcher &w) |
1322 | { |
1530 | { |
1323 | #if 0 /* replaced by a bgPixmap_t::render() - leve here temporarily for reference */ |
|
|
1324 | |
1531 | |
1325 | int i, aformat, rootdepth; |
1532 | int i, aformat, rootdepth; |
1326 | unsigned long nitems, bytes_after; |
1533 | unsigned long nitems, bytes_after; |
1327 | Atom atype; |
1534 | Atom atype; |
1328 | unsigned char *prop = NULL; |
1535 | unsigned char *prop = NULL; |
… | |
… | |
1333 | Window cr; |
1540 | Window cr; |
1334 | unsigned int rootpixmap_w = 0, rootpixmap_h = 0; |
1541 | unsigned int rootpixmap_w = 0, rootpixmap_h = 0; |
1335 | |
1542 | |
1336 | if (!option (Opt_transparent)) |
1543 | if (!option (Opt_transparent)) |
1337 | return; /* Don't try any more */ |
1544 | return; /* Don't try any more */ |
1338 | #if 0 |
|
|
1339 | struct timeval stv; |
|
|
1340 | gettimeofday (&stv,NULL); |
|
|
1341 | #define PRINT_BACKGROUND_OP_TIME do{ struct timeval tv;gettimeofday (&tv,NULL); tv.tv_sec-= stv.tv_sec;\ |
|
|
1342 | fprintf (stderr,"%d: elapsed %ld usec\n",__LINE__,\ |
|
|
1343 | tv.tv_sec*1000000+tv.tv_usec-stv.tv_usec );}while(0) |
|
|
1344 | #else |
|
|
1345 | #define PRINT_BACKGROUND_OP_TIME do{}while(0) |
|
|
1346 | #endif |
|
|
1347 | |
|
|
1348 | |
1545 | |
1349 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
1546 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
1350 | rootdepth = wrootattr.depth; |
1547 | rootdepth = wrootattr.depth; |
1351 | |
1548 | |
1352 | XGetWindowAttributes (dpy, parent[0], &wattr); |
1549 | XGetWindowAttributes (dpy, parent[0], &wattr); |
… | |
… | |
1486 | { |
1683 | { |
1487 | XImage *image = XGetImage (dpy, bgPixmap.pixmap, 0, 0, szHint.width, szHint.height, AllPlanes, ZPixmap); |
1684 | XImage *image = XGetImage (dpy, bgPixmap.pixmap, 0, 0, szHint.width, szHint.height, AllPlanes, ZPixmap); |
1488 | success = False; |
1685 | success = False; |
1489 | if (image != NULL) |
1686 | if (image != NULL) |
1490 | { |
1687 | { |
1491 | PRINT_BACKGROUND_OP_TIME; |
|
|
1492 | if (gc == NULL) |
1688 | if (gc == NULL) |
1493 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
1689 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
1494 | if (ISSET_PIXCOLOR (Color_tint) || shade != 100) |
1690 | if (ISSET_PIXCOLOR (Color_tint) || shade != 100) |
1495 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
1691 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
1496 | XPutImage (dpy, bgPixmap.pixmap, gc, image, 0, 0, 0, 0, image->width, image->height); |
1692 | XPutImage (dpy, bgPixmap.pixmap, gc, image, 0, 0, 0, 0, image->width, image->height); |
1497 | XDestroyImage (image); |
1693 | XDestroyImage (image); |
1498 | success = True; |
1694 | success = True; |
1499 | } |
1695 | } |
1500 | } |
1696 | } |
1501 | #endif /* HAVE_AFTERIMAGE */ |
1697 | #endif /* HAVE_AFTERIMAGE */ |
1502 | PRINT_BACKGROUND_OP_TIME; |
|
|
1503 | |
1698 | |
1504 | if (gc != NULL) |
1699 | if (gc != NULL) |
1505 | XFreeGC (dpy, gc); |
1700 | XFreeGC (dpy, gc); |
1506 | |
1701 | |
1507 | bgPixmap.apply(); |
1702 | bgPixmap.apply(); |
… | |
… | |
1526 | want_refresh = want_full_refresh = 1; |
1721 | want_refresh = want_full_refresh = 1; |
1527 | if (am_pixmap_trans) |
1722 | if (am_pixmap_trans) |
1528 | flush (); |
1723 | flush (); |
1529 | } |
1724 | } |
1530 | } |
1725 | } |
|
|
1726 | } |
1531 | #endif |
1727 | #endif |
1532 | } |
|
|
1533 | #endif |
|
|