… | |
… | |
31 | |
31 | |
32 | #if DO_TIMING_TEST |
32 | #if DO_TIMING_TEST |
33 | #define TIMING_TEST_START(id) \ |
33 | #define TIMING_TEST_START(id) \ |
34 | struct timeval timing_test_##id##_stv;\ |
34 | struct timeval timing_test_##id##_stv;\ |
35 | gettimeofday (&timing_test_##id##_stv, NULL); |
35 | gettimeofday (&timing_test_##id##_stv, NULL); |
36 | |
36 | |
37 | #define TIMING_TEST_PRINT_RESULT(id) \ |
37 | #define TIMING_TEST_PRINT_RESULT(id) \ |
38 | do{ struct timeval tv;gettimeofday (&tv, NULL); tv.tv_sec -= (timing_test_##id##_stv).tv_sec;\ |
38 | do{ struct timeval tv;gettimeofday (&tv, NULL); tv.tv_sec -= (timing_test_##id##_stv).tv_sec;\ |
39 | fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__,\ |
39 | fprintf (stderr, "%s: %s: %d: elapsed %ld usec\n", #id, __FILE__, __LINE__,\ |
40 | tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec);}while (0) |
40 | tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec);}while (0) |
41 | |
41 | |
… | |
… | |
87 | * scale Scale both up and down |
87 | * scale Scale both up and down |
88 | * auto Same as 100x100+50+50 |
88 | * auto Same as 100x100+50+50 |
89 | */ |
89 | */ |
90 | |
90 | |
91 | #ifdef HAVE_BG_PIXMAP |
91 | #ifdef HAVE_BG_PIXMAP |
92 | bgPixmap_t::bgPixmap_t() |
92 | bgPixmap_t::bgPixmap_t () |
93 | { |
93 | { |
94 | #ifdef HAVE_AFTERIMAGE |
94 | #ifdef HAVE_AFTERIMAGE |
95 | original_asim = NULL; |
95 | original_asim = NULL; |
96 | #endif |
96 | #endif |
97 | #ifdef BG_IMAGE_FROM_FILE |
97 | #ifdef BG_IMAGE_FROM_FILE |
… | |
… | |
100 | #endif |
100 | #endif |
101 | flags = 0; |
101 | flags = 0; |
102 | pixmap = None; |
102 | pixmap = None; |
103 | } |
103 | } |
104 | |
104 | |
|
|
105 | void |
|
|
106 | bgPixmap_t::destroy () |
|
|
107 | { |
|
|
108 | #ifdef HAVE_AFTERIMAGE |
|
|
109 | if (original_asim) |
|
|
110 | safe_asimage_destroy (original_asim); |
|
|
111 | #endif |
|
|
112 | |
|
|
113 | if (pixmap && target) |
|
|
114 | XFreePixmap (target->dpy, pixmap); |
|
|
115 | } |
105 | |
116 | |
106 | bool |
117 | bool |
107 | bgPixmap_t::window_size_sensitive () |
118 | bgPixmap_t::window_size_sensitive () |
108 | { |
119 | { |
|
|
120 | # ifdef ENABLE_TRANSPARENCY |
|
|
121 | if (flags & isTransparent) |
|
|
122 | return true; |
|
|
123 | # endif |
|
|
124 | |
109 | # ifdef BG_IMAGE_FROM_FILE |
125 | # ifdef BG_IMAGE_FROM_FILE |
110 | # ifdef HAVE_AFTERIMAGE |
126 | # ifdef HAVE_AFTERIMAGE |
111 | if (original_asim != NULL) |
127 | if (original_asim != NULL) |
112 | # endif |
128 | # endif |
113 | { |
129 | { |
114 | if (h_scale != 0 || v_scale != 0 |
130 | if (h_scale != 0 || v_scale != 0 |
115 | || h_align != 0 || v_align != 0) |
131 | || h_align != 0 || v_align != 0) |
116 | return true; |
132 | return true; |
117 | } |
133 | } |
118 | # endif |
134 | # endif |
|
|
135 | |
|
|
136 | return false; |
|
|
137 | } |
|
|
138 | |
|
|
139 | bool |
|
|
140 | bgPixmap_t::window_position_sensitive () |
|
|
141 | { |
119 | # ifdef ENABLE_TRANSPARENCY |
142 | # ifdef ENABLE_TRANSPARENCY |
120 | if (flags & isTransparent) |
143 | if (flags & isTransparent) |
121 | return true; |
144 | return true; |
122 | # endif |
145 | # endif |
|
|
146 | |
|
|
147 | # ifdef BG_IMAGE_FROM_FILE |
|
|
148 | # ifdef HAVE_AFTERIMAGE |
|
|
149 | if (original_asim != NULL) |
|
|
150 | # endif |
|
|
151 | { |
|
|
152 | if (h_align == rootAlign || v_align == rootAlign) |
|
|
153 | return true; |
|
|
154 | } |
|
|
155 | # endif |
|
|
156 | |
123 | return false; |
157 | return false; |
124 | } |
158 | }; |
125 | |
159 | |
126 | bool bgPixmap_t::need_client_side_rendering () |
160 | bool bgPixmap_t::need_client_side_rendering () |
127 | { |
161 | { |
128 | # ifdef HAVE_AFTERIMAGE |
162 | # ifdef HAVE_AFTERIMAGE |
129 | if (original_asim != NULL) |
163 | if (original_asim != NULL) |
… | |
… | |
132 | # ifdef ENABLE_TRANSPARENCY |
166 | # ifdef ENABLE_TRANSPARENCY |
133 | if (flags & isTransparent) |
167 | if (flags & isTransparent) |
134 | { |
168 | { |
135 | # ifdef HAVE_AFTERIMAGE // can't blur without libAI anyways |
169 | # ifdef HAVE_AFTERIMAGE // can't blur without libAI anyways |
136 | if ((flags & blurNeeded) && !(flags & blurServerSide)) |
170 | if ((flags & blurNeeded) && !(flags & blurServerSide)) |
137 | return true; |
171 | return true; |
138 | # endif |
172 | # endif |
139 | if ((flags & tintNeeded) && !(flags & tintServerSide)) |
173 | if ((flags & tintNeeded) && !(flags & tintServerSide)) |
140 | return true; |
174 | return true; |
141 | } |
175 | } |
142 | # endif |
176 | # endif |
… | |
… | |
163 | static inline bool |
197 | static inline bool |
164 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
198 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
165 | { |
199 | { |
166 | if (geom_flags & flag) |
200 | if (geom_flags & flag) |
167 | { |
201 | { |
|
|
202 | if (new_value != bgPixmap_t::rootAlign) |
|
|
203 | { |
168 | if (new_value < -100) |
204 | if (new_value < -100) |
169 | new_value = -100; |
205 | new_value = -100; |
170 | else if (new_value > 200) |
206 | else if (new_value > 200) |
171 | new_value = 200; |
207 | new_value = 200; |
|
|
208 | } |
172 | if (new_value != align) |
209 | if (new_value != align) |
173 | { |
210 | { |
174 | align = new_value; |
211 | align = new_value; |
175 | return true; |
212 | return true; |
176 | } |
213 | } |
… | |
… | |
318 | else if (!(flags & geometrySet)) |
355 | else if (!(flags & geometrySet)) |
319 | { /* default geometry - scaled and centered */ |
356 | { /* default geometry - scaled and centered */ |
320 | x = y = defaultAlign; |
357 | x = y = defaultAlign; |
321 | w = h = defaultScale; |
358 | w = h = defaultScale; |
322 | } |
359 | } |
323 | |
360 | |
324 | if (!(flags & geometrySet)) |
361 | if (!(flags & geometrySet)) |
325 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
362 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
326 | |
363 | |
327 | if (ops) |
364 | if (ops) |
328 | { |
365 | { |
… | |
… | |
330 | { |
367 | { |
331 | while (*ops == ':' || isspace(*ops)) ++ops; |
368 | while (*ops == ':' || isspace(*ops)) ++ops; |
332 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
369 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
333 | if (CHECK_GEOM_OPS("tile")) |
370 | if (CHECK_GEOM_OPS("tile")) |
334 | { |
371 | { |
335 | w = h = 0; |
372 | w = h = noScale; |
336 | geom_flags |= WidthValue|HeightValue; |
373 | geom_flags |= WidthValue|HeightValue; |
337 | } |
374 | } |
338 | else if (CHECK_GEOM_OPS("propscale")) |
375 | else if (CHECK_GEOM_OPS("propscale")) |
339 | { |
376 | { |
340 | if (w == 0 && h == 0) |
377 | if (w == 0 && h == 0) |
341 | { |
378 | { |
342 | w = 100; |
379 | w = windowScale; |
343 | geom_flags |= WidthValue; |
380 | geom_flags |= WidthValue; |
344 | } |
381 | } |
345 | new_flags |= propScale; |
382 | new_flags |= propScale; |
346 | } |
383 | } |
347 | else if (CHECK_GEOM_OPS("hscale")) |
384 | else if (CHECK_GEOM_OPS("hscale")) |
348 | { |
385 | { |
349 | if (w == 0) |
386 | if (w == 0) |
350 | w = 100; |
387 | w = windowScale; |
351 | h = 0; |
388 | h = noScale; |
352 | geom_flags |= WidthValue|HeightValue; |
389 | geom_flags |= WidthValue|HeightValue; |
353 | } |
390 | } |
354 | else if (CHECK_GEOM_OPS("vscale")) |
391 | else if (CHECK_GEOM_OPS("vscale")) |
355 | { |
392 | { |
356 | if (h == 0) |
393 | if (h == 0) |
357 | h = 100; |
394 | h = windowScale; |
358 | w = 0; |
395 | w = noScale; |
359 | geom_flags |= WidthValue|HeightValue; |
396 | geom_flags |= WidthValue|HeightValue; |
360 | } |
397 | } |
361 | else if (CHECK_GEOM_OPS("scale")) |
398 | else if (CHECK_GEOM_OPS("scale")) |
362 | { |
399 | { |
363 | if (h == 0) |
400 | if (h == 0) |
364 | h = 100; |
401 | h = windowScale; |
365 | if (w == 0) |
402 | if (w == 0) |
366 | w = 100; |
403 | w = windowScale; |
367 | geom_flags |= WidthValue|HeightValue; |
404 | geom_flags |= WidthValue|HeightValue; |
368 | } |
405 | } |
369 | else if (CHECK_GEOM_OPS("auto")) |
406 | else if (CHECK_GEOM_OPS("auto")) |
370 | { |
407 | { |
|
|
408 | w = h = windowScale; |
|
|
409 | x = y = centerAlign; |
|
|
410 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
|
|
411 | } |
|
|
412 | else if (CHECK_GEOM_OPS("root")) |
|
|
413 | { |
371 | w = h = 100; |
414 | w = h = noScale; |
372 | x = y = 50; |
415 | x = y = rootAlign; |
373 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
416 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
374 | } |
417 | } |
375 | # undef CHECK_GEOM_OPS |
418 | # undef CHECK_GEOM_OPS |
376 | while (*ops != ':' && *ops != '\0') ++ops; |
419 | while (*ops != ':' && *ops != '\0') ++ops; |
377 | } /* done parsing ops */ |
420 | } /* done parsing ops */ |
… | |
… | |
416 | |
459 | |
417 | TIMING_TEST_START (asim); |
460 | TIMING_TEST_START (asim); |
418 | |
461 | |
419 | if (original_asim) |
462 | if (original_asim) |
420 | { |
463 | { |
|
|
464 | if (h_align == rootAlign || v_align == rootAlign) |
|
|
465 | { |
|
|
466 | target->get_window_origin(x, y); |
|
|
467 | x = -x; |
|
|
468 | y = -y; |
|
|
469 | } |
|
|
470 | if (h_align != rootAlign) |
421 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
471 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
|
|
472 | if (v_align != rootAlign) |
422 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
473 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
423 | } |
474 | } |
424 | |
475 | |
425 | if (original_asim == NULL |
476 | if (original_asim == NULL |
426 | || x >= target_width |
477 | || x >= target_width |
427 | || y >= target_height |
478 | || y >= target_height |
… | |
… | |
449 | { |
500 | { |
450 | result = original_asim; |
501 | result = original_asim; |
451 | if ((w > 0 && w != original_asim->width) |
502 | if ((w > 0 && w != original_asim->width) |
452 | || (h > 0 && h != original_asim->height)) |
503 | || (h > 0 && h != original_asim->height)) |
453 | { |
504 | { |
454 | result = scale_asimage (target->asv, original_asim, |
505 | result = scale_asimage (target->asv, original_asim, |
455 | w > 0 ? w : original_asim->width, |
506 | w > 0 ? w : original_asim->width, |
456 | h > 0 ? h : original_asim->height, |
507 | h > 0 ? h : original_asim->height, |
457 | background ? ASA_ASImage : ASA_XImage, |
508 | background ? ASA_ASImage : ASA_XImage, |
458 | 100, ASIMAGE_QUALITY_DEFAULT); |
509 | 100, ASIMAGE_QUALITY_DEFAULT); |
459 | } |
510 | } |
460 | if (background == NULL) |
511 | if (background == NULL) |
461 | {/* if tiling - pixmap has to be sized exactly as the image */ |
512 | {/* if tiling - pixmap has to be sized exactly as the image, |
|
|
513 | but there is no need to make it bigger then the window! */ |
462 | if (h_scale == 0) |
514 | if (h_scale == 0) |
463 | new_pmap_width = result->width; |
515 | new_pmap_width = min (result->width, target_width); |
464 | if (v_scale == 0) |
516 | if (v_scale == 0) |
465 | new_pmap_height = result->height; |
517 | new_pmap_height = min (result->height, target_height); |
466 | /* we also need to tile our image in one or both directions */ |
518 | /* we also need to tile our image in one or both directions */ |
467 | if (h_scale == 0 || v_scale == 0) |
519 | if (h_scale == 0 || v_scale == 0) |
468 | { |
520 | { |
469 | ASImage *tmp = tile_asimage (target->asv, result, |
521 | ASImage *tmp = tile_asimage (target->asv, result, |
470 | (h_scale > 0) ? 0 : (int)result->width - x, |
522 | (h_scale > 0) ? 0 : (int)result->width - x, |
471 | (v_scale > 0) ? 0 : (int)result->height - y, |
523 | (v_scale > 0) ? 0 : (int)result->height - y, |
|
|
524 | new_pmap_width, |
472 | result->width, result->height, |
525 | new_pmap_height, |
473 | TINT_LEAVE_SAME, ASA_XImage, |
526 | TINT_LEAVE_SAME, ASA_XImage, |
474 | 100, ASIMAGE_QUALITY_DEFAULT); |
527 | 100, ASIMAGE_QUALITY_DEFAULT); |
475 | if (tmp) |
528 | if (tmp) |
476 | { |
529 | { |
477 | if (result != original_asim) |
530 | if (result != original_asim) |
… | |
… | |
578 | } |
631 | } |
579 | |
632 | |
580 | /* put result on pixmap */ |
633 | /* put result on pixmap */ |
581 | if (dst_x < new_pmap_width && dst_y < new_pmap_height) |
634 | if (dst_x < new_pmap_width && dst_y < new_pmap_height) |
582 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
635 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
583 | |
636 | |
584 | if (result != background && result != original_asim) |
637 | if (result != background && result != original_asim) |
585 | destroy_asimage (&result); |
638 | destroy_asimage (&result); |
586 | |
639 | |
587 | XFreeGC (target->dpy, gc); |
640 | XFreeGC (target->dpy, gc); |
588 | TIMING_TEST_PRINT_RESULT (asim); |
641 | TIMING_TEST_PRINT_RESULT (asim); |
… | |
… | |
614 | f[len] = '\0'; |
667 | f[len] = '\0'; |
615 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
668 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
616 | free (f); |
669 | free (f); |
617 | } |
670 | } |
618 | return (original_asim != NULL); |
671 | return (original_asim != NULL); |
619 | # endif |
672 | # endif |
620 | } |
673 | } |
621 | return false; |
674 | return false; |
622 | } |
675 | } |
623 | |
676 | |
624 | # endif /* BG_IMAGE_FROM_FILE */ |
677 | # endif /* BG_IMAGE_FROM_FILE */ |
625 | |
678 | |
626 | # ifdef ENABLE_TRANSPARENCY |
679 | # ifdef ENABLE_TRANSPARENCY |
627 | bool |
680 | bool |
628 | bgPixmap_t::set_transparent () |
681 | bgPixmap_t::set_transparent () |
629 | { |
682 | { |
630 | if (!(flags & isTransparent)) |
683 | if (!(flags & isTransparent)) |
631 | { |
684 | { |
632 | flags |= isTransparent; |
685 | flags |= isTransparent; |
… | |
… | |
657 | if (v_blurRadius != vr) |
710 | if (v_blurRadius != vr) |
658 | { |
711 | { |
659 | ++changed; |
712 | ++changed; |
660 | v_blurRadius = vr; |
713 | v_blurRadius = vr; |
661 | } |
714 | } |
662 | |
715 | |
663 | if (v_blurRadius == 0 && h_blurRadius == 0) |
716 | if (v_blurRadius == 0 && h_blurRadius == 0) |
664 | flags &= ~blurNeeded; |
717 | flags &= ~blurNeeded; |
665 | else |
718 | else |
666 | flags |= blurNeeded; |
719 | flags |= blurNeeded; |
667 | |
720 | |
… | |
… | |
694 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
747 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
695 | { |
748 | { |
696 | flags |= bgPixmap_t::tintNeeded; |
749 | flags |= bgPixmap_t::tintNeeded; |
697 | } |
750 | } |
698 | } |
751 | } |
699 | |
752 | |
700 | if (flags & bgPixmap_t::tintNeeded) |
753 | if (flags & bgPixmap_t::tintNeeded) |
701 | { |
754 | { |
702 | if (flags & bgPixmap_t::tintWholesome) |
755 | if (flags & bgPixmap_t::tintWholesome) |
703 | flags |= bgPixmap_t::tintServerSide; |
756 | flags |= bgPixmap_t::tintServerSide; |
704 | else |
757 | else |
… | |
… | |
741 | bool |
794 | bool |
742 | bgPixmap_t::set_shade (const char *shade_str) |
795 | bgPixmap_t::set_shade (const char *shade_str) |
743 | { |
796 | { |
744 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
797 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
745 | |
798 | |
|
|
799 | if (new_shade < 0 && new_shade > -100) |
|
|
800 | new_shade = 200 - (100 + new_shade); |
746 | if (new_shade == 100) |
801 | else if (new_shade == 100) |
747 | new_shade = 0; |
802 | new_shade = 0; |
748 | |
803 | |
749 | if (new_shade != shade) |
804 | if (new_shade != shade) |
750 | { |
805 | { |
751 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
806 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
… | |
… | |
754 | return true; |
809 | return true; |
755 | } |
810 | } |
756 | return false; |
811 | return false; |
757 | } |
812 | } |
758 | |
813 | |
759 | /* make_transparency_pixmap() |
814 | /* make_transparency_pixmap() |
760 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
815 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
761 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
816 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
762 | * our window. |
817 | * our window. |
763 | */ |
818 | */ |
764 | unsigned long |
819 | unsigned long |
765 | bgPixmap_t::make_transparency_pixmap () |
820 | bgPixmap_t::make_transparency_pixmap () |
766 | { |
821 | { |
… | |
… | |
882 | } |
937 | } |
883 | TIMING_TEST_PRINT_RESULT (tp); |
938 | TIMING_TEST_PRINT_RESULT (tp); |
884 | |
939 | |
885 | if (tiled_root_pmap != None) |
940 | if (tiled_root_pmap != None) |
886 | { |
941 | { |
887 | if (!need_client_side_rendering ()) |
942 | if (!need_client_side_rendering ()) |
888 | { |
943 | { |
889 | if ((flags & tintNeeded)) |
944 | if ((flags & tintNeeded)) |
890 | { |
945 | { |
891 | if (flags & tintWholesome) |
946 | if (flags & tintWholesome) |
892 | { |
947 | { |
893 | /* In this case we can tint image server-side getting significant |
948 | /* In this case we can tint image server-side getting significant |
894 | * performance improvements, as we eliminate XImage transfer |
949 | * performance improvements, as we eliminate XImage transfer |
… | |
… | |
935 | pf.direct.greenMask = 0xff; |
990 | pf.direct.greenMask = 0xff; |
936 | pf.direct.blueMask = 0xff; |
991 | pf.direct.blueMask = 0xff; |
937 | pf.direct.alphaMask = 0xff; |
992 | pf.direct.alphaMask = 0xff; |
938 | |
993 | |
939 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
994 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
940 | (PictFormatType| |
995 | (PictFormatType| |
941 | PictFormatDepth| |
996 | PictFormatDepth| |
942 | PictFormatRedMask| |
997 | PictFormatRedMask| |
943 | PictFormatGreenMask| |
998 | PictFormatGreenMask| |
944 | PictFormatBlueMask| |
999 | PictFormatBlueMask| |
945 | PictFormatAlphaMask), |
1000 | PictFormatAlphaMask), |
946 | &pf, |
1001 | &pf, |
947 | 0); |
1002 | 0); |
948 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
1003 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
949 | XRenderPictureAttributes pa ; |
1004 | XRenderPictureAttributes pa ; |
950 | |
1005 | |
951 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
1006 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
952 | |
1007 | |
… | |
… | |
954 | |
1009 | |
955 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1010 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
956 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
1011 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
957 | XFreePixmap (dpy, overlay_pmap); |
1012 | XFreePixmap (dpy, overlay_pmap); |
958 | |
1013 | |
959 | pa.component_alpha = True; |
1014 | pa.component_alpha = True; |
960 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1015 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
961 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
1016 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
962 | XFreePixmap (dpy, mask_pmap); |
1017 | XFreePixmap (dpy, mask_pmap); |
963 | |
1018 | |
964 | if (mask_pic && overlay_pic && back_pic) |
1019 | if (mask_pic && overlay_pic && back_pic) |
… | |
… | |
980 | XRenderFreePicture (dpy, mask_pic); |
1035 | XRenderFreePicture (dpy, mask_pic); |
981 | XRenderFreePicture (dpy, overlay_pic); |
1036 | XRenderFreePicture (dpy, overlay_pic); |
982 | XRenderFreePicture (dpy, back_pic); |
1037 | XRenderFreePicture (dpy, back_pic); |
983 | # if DO_TIMING_TEST |
1038 | # if DO_TIMING_TEST |
984 | XSync (dpy, False); |
1039 | XSync (dpy, False); |
985 | # endif |
1040 | # endif |
986 | # endif |
1041 | # endif |
987 | } |
1042 | } |
988 | } |
1043 | } |
989 | } /* server side rendering completed */ |
1044 | } /* server side rendering completed */ |
990 | |
1045 | |
… | |
… | |
994 | pixmap = tiled_root_pmap; |
1049 | pixmap = tiled_root_pmap; |
995 | pmap_width = window_width; |
1050 | pmap_width = window_width; |
996 | pmap_height = window_height; |
1051 | pmap_height = window_height; |
997 | pmap_depth = root_depth; |
1052 | pmap_depth = root_depth; |
998 | } |
1053 | } |
999 | |
1054 | |
1000 | if (gc) |
1055 | if (gc) |
1001 | XFreeGC (dpy, gc); |
1056 | XFreeGC (dpy, gc); |
1002 | |
1057 | |
1003 | TIMING_TEST_PRINT_RESULT (tp); |
1058 | TIMING_TEST_PRINT_RESULT (tp); |
1004 | |
1059 | |
1005 | return result; |
1060 | return result; |
1006 | } |
1061 | } |
1007 | |
1062 | |
1008 | bool |
1063 | bool |
1009 | bgPixmap_t::set_root_pixmap () |
1064 | bgPixmap_t::set_root_pixmap () |
1010 | { |
1065 | { |
1011 | Pixmap new_root_pixmap = None; |
1066 | Pixmap new_root_pixmap = None; |
1012 | |
1067 | |
1013 | new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1068 | new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1014 | if (new_root_pixmap == None) |
1069 | if (new_root_pixmap == None) |
1015 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1070 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1016 | |
1071 | |
1017 | if (new_root_pixmap != root_pixmap) |
1072 | if (new_root_pixmap != root_pixmap) |
… | |
… | |
1100 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1155 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1101 | } |
1156 | } |
1102 | |
1157 | |
1103 | # elif !XFT /* our own client-side tinting */ |
1158 | # elif !XFT /* our own client-side tinting */ |
1104 | |
1159 | |
1105 | /* ATTENTION: We ASSUME that XFT will let us do all the tinint neccessary server-side. |
1160 | /* ATTENTION: We ASSUME that XFT will let us do all the tinting neccessary server-side. |
1106 | This may need to be changed in need_client_seide_rendering() logic is altered !!! */ |
1161 | This may need to be changed in need_client_side_rendering() logic is altered !!! */ |
1107 | |
1162 | |
1108 | if (background_flags && (flags & isInvalid)) |
1163 | if (background_flags && (flags & isInvalid)) |
1109 | { |
1164 | { |
1110 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1165 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1111 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1166 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
… | |
… | |
1165 | |
1220 | |
1166 | apply (); |
1221 | apply (); |
1167 | |
1222 | |
1168 | TIMING_TEST_PRINT_RESULT (tp); |
1223 | TIMING_TEST_PRINT_RESULT (tp); |
1169 | |
1224 | |
1170 | return true; |
1225 | return true; |
1171 | } |
1226 | } |
1172 | |
1227 | |
1173 | bool |
1228 | bool |
1174 | bgPixmap_t::set_target (rxvt_term *new_target) |
1229 | bgPixmap_t::set_target (rxvt_term *new_target) |
1175 | { |
1230 | { |
1176 | if (new_target) |
1231 | if (new_target) |
1177 | if (target != new_target) |
1232 | if (target != new_target) |
1178 | { |
1233 | { |
… | |
… | |
1225 | # if HAVE_SCROLLBARS |
1280 | # if HAVE_SCROLLBARS |
1226 | if (target->scrollBar.win) |
1281 | if (target->scrollBar.win) |
1227 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1282 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1228 | # endif |
1283 | # endif |
1229 | } |
1284 | } |
1230 | /* don't want Expose on the parent or vt. It is better to use |
1285 | /* don't want Expose on the parent or vt. It is better to use |
1231 | scr_touch or we get a great deal of flicker otherwise: */ |
1286 | scr_touch or we get a great deal of flicker otherwise: */ |
1232 | XClearWindow (target->dpy, target->parent[0]); |
1287 | XClearWindow (target->dpy, target->parent[0]); |
1233 | |
1288 | |
1234 | # if HAVE_SCROLLBARS |
1289 | # if HAVE_SCROLLBARS |
1235 | if (target->scrollBar.win) |
1290 | if (target->scrollBar.win) |
… | |
… | |
1242 | target->want_refresh = 1; |
1297 | target->want_refresh = 1; |
1243 | flags |= hasChanged; |
1298 | flags |= hasChanged; |
1244 | } |
1299 | } |
1245 | } |
1300 | } |
1246 | |
1301 | |
1247 | #endif /* HAVE_BG_PIXMAP */ |
1302 | #endif /* HAVE_BG_PIXMAP */ |
1248 | |
1303 | |
1249 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1304 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1250 | /* taken from aterm-0.4.2 */ |
1305 | /* taken from aterm-0.4.2 */ |
1251 | |
1306 | |
1252 | typedef uint32_t RUINT32T; |
1307 | typedef uint32_t RUINT32T; |