… | |
… | |
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 | |
… | |
… | |
100 | #endif |
100 | #endif |
101 | flags = 0; |
101 | flags = 0; |
102 | pixmap = None; |
102 | pixmap = None; |
103 | } |
103 | } |
104 | |
104 | |
|
|
105 | bgPixmap_t::~bgPixmap_t() |
|
|
106 | { |
|
|
107 | #ifdef HAVE_AFTERIMAGE |
|
|
108 | if (original_asim) |
|
|
109 | safe_asimage_destroy (original_asim); |
|
|
110 | #endif |
|
|
111 | if (pixmap && target) |
|
|
112 | XFreePixmap (target->dpy, pixmap); |
|
|
113 | } |
105 | |
114 | |
106 | bool |
115 | bool |
107 | bgPixmap_t::window_size_sensitive () |
116 | bgPixmap_t::window_size_sensitive () |
108 | { |
117 | { |
|
|
118 | # ifdef ENABLE_TRANSPARENCY |
|
|
119 | if (flags & isTransparent) |
|
|
120 | return true; |
|
|
121 | # endif |
|
|
122 | |
109 | # ifdef BG_IMAGE_FROM_FILE |
123 | # ifdef BG_IMAGE_FROM_FILE |
110 | # ifdef HAVE_AFTERIMAGE |
124 | # ifdef HAVE_AFTERIMAGE |
111 | if (original_asim != NULL) |
125 | if (original_asim != NULL) |
112 | # endif |
126 | # endif |
113 | { |
127 | { |
114 | if (h_scale != 0 || v_scale != 0 |
128 | if (h_scale != 0 || v_scale != 0 |
115 | || h_align != 0 || v_align != 0) |
129 | || h_align != 0 || v_align != 0) |
116 | return true; |
130 | return true; |
117 | } |
131 | } |
118 | # endif |
132 | # endif |
|
|
133 | |
|
|
134 | return false; |
|
|
135 | } |
|
|
136 | |
|
|
137 | bool |
|
|
138 | bgPixmap_t::window_position_sensitive () |
|
|
139 | { |
119 | # ifdef ENABLE_TRANSPARENCY |
140 | # ifdef ENABLE_TRANSPARENCY |
120 | if (flags & isTransparent) |
141 | if (flags & isTransparent) |
121 | return true; |
142 | return true; |
122 | # endif |
143 | # endif |
|
|
144 | |
|
|
145 | # ifdef BG_IMAGE_FROM_FILE |
|
|
146 | # ifdef HAVE_AFTERIMAGE |
|
|
147 | if (original_asim != NULL) |
|
|
148 | # endif |
|
|
149 | { |
|
|
150 | if (h_align == rootAlign || v_align == rootAlign) |
|
|
151 | return true; |
|
|
152 | } |
|
|
153 | # endif |
|
|
154 | |
123 | return false; |
155 | return false; |
124 | } |
156 | }; |
125 | |
157 | |
126 | bool bgPixmap_t::need_client_side_rendering () |
158 | bool bgPixmap_t::need_client_side_rendering () |
127 | { |
159 | { |
128 | # ifdef HAVE_AFTERIMAGE |
160 | # ifdef HAVE_AFTERIMAGE |
129 | if (original_asim != NULL) |
161 | if (original_asim != NULL) |
130 | return true; |
162 | return true; |
131 | # endif |
163 | # endif |
132 | # ifdef ENABLE_TRANSPARENCY |
164 | # ifdef ENABLE_TRANSPARENCY |
133 | if (flags & isTransparent) |
165 | if (flags & isTransparent) |
134 | { |
166 | { |
|
|
167 | # ifdef HAVE_AFTERIMAGE // can't blur without libAI anyways |
135 | if (((flags & blurNeeded) && !(flags & blurServerSide)) |
168 | if ((flags & blurNeeded) && !(flags & blurServerSide)) |
|
|
169 | return true; |
|
|
170 | # endif |
136 | || ((flags & tintNeeded) && !(flags & tintServerSide))) |
171 | if ((flags & tintNeeded) && !(flags & tintServerSide)) |
137 | return true; |
172 | return true; |
138 | } |
173 | } |
139 | # endif |
174 | # endif |
140 | return false; |
175 | return false; |
141 | } |
176 | } |
142 | |
177 | |
… | |
… | |
160 | static inline bool |
195 | static inline bool |
161 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
196 | check_set_align_value (int geom_flags, int flag, int &align, int new_value) |
162 | { |
197 | { |
163 | if (geom_flags & flag) |
198 | if (geom_flags & flag) |
164 | { |
199 | { |
|
|
200 | if (new_value != bgPixmap_t::rootAlign) |
|
|
201 | { |
165 | if (new_value < -100) |
202 | if (new_value < -100) |
166 | new_value = -100; |
203 | new_value = -100; |
167 | else if (new_value > 200) |
204 | else if (new_value > 200) |
168 | new_value = 200; |
205 | new_value = 200; |
|
|
206 | } |
169 | if (new_value != align) |
207 | if (new_value != align) |
170 | { |
208 | { |
171 | align = new_value; |
209 | align = new_value; |
172 | return true; |
210 | return true; |
173 | } |
211 | } |
… | |
… | |
315 | else if (!(flags & geometrySet)) |
353 | else if (!(flags & geometrySet)) |
316 | { /* default geometry - scaled and centered */ |
354 | { /* default geometry - scaled and centered */ |
317 | x = y = defaultAlign; |
355 | x = y = defaultAlign; |
318 | w = h = defaultScale; |
356 | w = h = defaultScale; |
319 | } |
357 | } |
320 | |
358 | |
321 | if (!(flags & geometrySet)) |
359 | if (!(flags & geometrySet)) |
322 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
360 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
323 | |
361 | |
324 | if (ops) |
362 | if (ops) |
325 | { |
363 | { |
… | |
… | |
327 | { |
365 | { |
328 | while (*ops == ':' || isspace(*ops)) ++ops; |
366 | while (*ops == ':' || isspace(*ops)) ++ops; |
329 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
367 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
330 | if (CHECK_GEOM_OPS("tile")) |
368 | if (CHECK_GEOM_OPS("tile")) |
331 | { |
369 | { |
332 | w = h = 0; |
370 | w = h = noScale; |
333 | geom_flags |= WidthValue|HeightValue; |
371 | geom_flags |= WidthValue|HeightValue; |
334 | } |
372 | } |
335 | else if (CHECK_GEOM_OPS("propscale")) |
373 | else if (CHECK_GEOM_OPS("propscale")) |
336 | { |
374 | { |
337 | if (w == 0 && h == 0) |
375 | if (w == 0 && h == 0) |
338 | { |
376 | { |
339 | w = 100; |
377 | w = windowScale; |
340 | geom_flags |= WidthValue; |
378 | geom_flags |= WidthValue; |
341 | } |
379 | } |
342 | new_flags |= propScale; |
380 | new_flags |= propScale; |
343 | } |
381 | } |
344 | else if (CHECK_GEOM_OPS("hscale")) |
382 | else if (CHECK_GEOM_OPS("hscale")) |
345 | { |
383 | { |
346 | if (w == 0) |
384 | if (w == 0) |
347 | w = 100; |
385 | w = windowScale; |
348 | h = 0; |
386 | h = noScale; |
349 | geom_flags |= WidthValue|HeightValue; |
387 | geom_flags |= WidthValue|HeightValue; |
350 | } |
388 | } |
351 | else if (CHECK_GEOM_OPS("vscale")) |
389 | else if (CHECK_GEOM_OPS("vscale")) |
352 | { |
390 | { |
353 | if (h == 0) |
391 | if (h == 0) |
354 | h = 100; |
392 | h = windowScale; |
355 | w = 0; |
393 | w = noScale; |
356 | geom_flags |= WidthValue|HeightValue; |
394 | geom_flags |= WidthValue|HeightValue; |
357 | } |
395 | } |
358 | else if (CHECK_GEOM_OPS("scale")) |
396 | else if (CHECK_GEOM_OPS("scale")) |
359 | { |
397 | { |
360 | if (h == 0) |
398 | if (h == 0) |
361 | h = 100; |
399 | h = windowScale; |
362 | if (w == 0) |
400 | if (w == 0) |
363 | w = 100; |
401 | w = windowScale; |
364 | geom_flags |= WidthValue|HeightValue; |
402 | geom_flags |= WidthValue|HeightValue; |
365 | } |
403 | } |
366 | else if (CHECK_GEOM_OPS("auto")) |
404 | else if (CHECK_GEOM_OPS("auto")) |
367 | { |
405 | { |
|
|
406 | w = h = windowScale; |
|
|
407 | x = y = centerAlign; |
|
|
408 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
|
|
409 | } |
|
|
410 | else if (CHECK_GEOM_OPS("root")) |
|
|
411 | { |
368 | w = h = 100; |
412 | w = h = noScale; |
369 | x = y = 50; |
413 | x = y = rootAlign; |
370 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
414 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
371 | } |
415 | } |
372 | # undef CHECK_GEOM_OPS |
416 | # undef CHECK_GEOM_OPS |
373 | while (*ops != ':' && *ops != '\0') ++ops; |
417 | while (*ops != ':' && *ops != '\0') ++ops; |
374 | } /* done parsing ops */ |
418 | } /* done parsing ops */ |
… | |
… | |
413 | |
457 | |
414 | TIMING_TEST_START (asim); |
458 | TIMING_TEST_START (asim); |
415 | |
459 | |
416 | if (original_asim) |
460 | if (original_asim) |
417 | { |
461 | { |
|
|
462 | if (h_align == rootAlign || v_align == rootAlign) |
|
|
463 | { |
|
|
464 | target->get_window_origin(x, y); |
|
|
465 | x = -x; |
|
|
466 | y = -y; |
|
|
467 | } |
|
|
468 | if (h_align != rootAlign) |
418 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
469 | x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); |
|
|
470 | if (v_align != rootAlign) |
419 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
471 | y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); |
420 | } |
472 | } |
421 | |
473 | |
422 | if (original_asim == NULL |
474 | if (original_asim == NULL |
423 | || x >= target_width |
475 | || x >= target_width |
424 | || y >= target_height |
476 | || y >= target_height |
… | |
… | |
446 | { |
498 | { |
447 | result = original_asim; |
499 | result = original_asim; |
448 | if ((w > 0 && w != original_asim->width) |
500 | if ((w > 0 && w != original_asim->width) |
449 | || (h > 0 && h != original_asim->height)) |
501 | || (h > 0 && h != original_asim->height)) |
450 | { |
502 | { |
451 | result = scale_asimage (target->asv, original_asim, |
503 | result = scale_asimage (target->asv, original_asim, |
452 | w > 0 ? w : original_asim->width, |
504 | w > 0 ? w : original_asim->width, |
453 | h > 0 ? h : original_asim->height, |
505 | h > 0 ? h : original_asim->height, |
454 | background ? ASA_ASImage : ASA_XImage, |
506 | background ? ASA_ASImage : ASA_XImage, |
455 | 100, ASIMAGE_QUALITY_DEFAULT); |
507 | 100, ASIMAGE_QUALITY_DEFAULT); |
456 | } |
508 | } |
457 | if (background == NULL) |
509 | if (background == NULL) |
458 | {/* if tiling - pixmap has to be sized exactly as the image */ |
510 | {/* if tiling - pixmap has to be sized exactly as the image, |
|
|
511 | but there is no need to make it bigger then the window! */ |
459 | if (h_scale == 0) |
512 | if (h_scale == 0) |
460 | new_pmap_width = result->width; |
513 | new_pmap_width = min (result->width, target_width); |
461 | if (v_scale == 0) |
514 | if (v_scale == 0) |
462 | new_pmap_height = result->height; |
515 | new_pmap_height = min (result->height, target_height); |
463 | /* we also need to tile our image in one or both directions */ |
516 | /* we also need to tile our image in one or both directions */ |
464 | if (h_scale == 0 || v_scale == 0) |
517 | if (h_scale == 0 || v_scale == 0) |
465 | { |
518 | { |
466 | ASImage *tmp = tile_asimage (target->asv, result, |
519 | ASImage *tmp = tile_asimage (target->asv, result, |
467 | (h_scale > 0) ? 0 : (int)result->width - x, |
520 | (h_scale > 0) ? 0 : (int)result->width - x, |
468 | (v_scale > 0) ? 0 : (int)result->height - y, |
521 | (v_scale > 0) ? 0 : (int)result->height - y, |
|
|
522 | new_pmap_width, |
469 | result->width, result->height, |
523 | new_pmap_height, |
470 | TINT_LEAVE_SAME, ASA_XImage, |
524 | TINT_LEAVE_SAME, ASA_XImage, |
471 | 100, ASIMAGE_QUALITY_DEFAULT); |
525 | 100, ASIMAGE_QUALITY_DEFAULT); |
472 | if (tmp) |
526 | if (tmp) |
473 | { |
527 | { |
474 | if (result != original_asim) |
528 | if (result != original_asim) |
… | |
… | |
575 | } |
629 | } |
576 | |
630 | |
577 | /* put result on pixmap */ |
631 | /* put result on pixmap */ |
578 | if (dst_x < new_pmap_width && dst_y < new_pmap_height) |
632 | if (dst_x < new_pmap_width && dst_y < new_pmap_height) |
579 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
633 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
580 | |
634 | |
581 | if (result != background && result != original_asim) |
635 | if (result != background && result != original_asim) |
582 | destroy_asimage (&result); |
636 | destroy_asimage (&result); |
583 | |
637 | |
584 | XFreeGC (target->dpy, gc); |
638 | XFreeGC (target->dpy, gc); |
585 | TIMING_TEST_PRINT_RESULT (asim); |
639 | TIMING_TEST_PRINT_RESULT (asim); |
… | |
… | |
611 | f[len] = '\0'; |
665 | f[len] = '\0'; |
612 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
666 | original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); |
613 | free (f); |
667 | free (f); |
614 | } |
668 | } |
615 | return (original_asim != NULL); |
669 | return (original_asim != NULL); |
616 | # endif |
670 | # endif |
617 | } |
671 | } |
618 | return false; |
672 | return false; |
619 | } |
673 | } |
620 | |
674 | |
621 | # endif /* BG_IMAGE_FROM_FILE */ |
675 | # endif /* BG_IMAGE_FROM_FILE */ |
622 | |
676 | |
623 | # ifdef ENABLE_TRANSPARENCY |
677 | # ifdef ENABLE_TRANSPARENCY |
624 | bool |
678 | bool |
625 | bgPixmap_t::set_transparent () |
679 | bgPixmap_t::set_transparent () |
626 | { |
680 | { |
627 | if (!(flags & isTransparent)) |
681 | if (!(flags & isTransparent)) |
628 | { |
682 | { |
629 | flags |= isTransparent; |
683 | flags |= isTransparent; |
… | |
… | |
654 | if (v_blurRadius != vr) |
708 | if (v_blurRadius != vr) |
655 | { |
709 | { |
656 | ++changed; |
710 | ++changed; |
657 | v_blurRadius = vr; |
711 | v_blurRadius = vr; |
658 | } |
712 | } |
659 | |
713 | |
660 | if (v_blurRadius == 0 && h_blurRadius == 0) |
714 | if (v_blurRadius == 0 && h_blurRadius == 0) |
661 | flags &= ~blurNeeded; |
715 | flags &= ~blurNeeded; |
662 | else |
716 | else |
663 | flags |= blurNeeded; |
717 | flags |= blurNeeded; |
664 | |
718 | |
… | |
… | |
691 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
745 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
692 | { |
746 | { |
693 | flags |= bgPixmap_t::tintNeeded; |
747 | flags |= bgPixmap_t::tintNeeded; |
694 | } |
748 | } |
695 | } |
749 | } |
696 | |
750 | |
697 | if (flags & bgPixmap_t::tintNeeded) |
751 | if (flags & bgPixmap_t::tintNeeded) |
698 | { |
752 | { |
699 | if (flags & bgPixmap_t::tintWholesome) |
753 | if (flags & bgPixmap_t::tintWholesome) |
700 | flags |= bgPixmap_t::tintServerSide; |
754 | flags |= bgPixmap_t::tintServerSide; |
701 | else |
755 | else |
… | |
… | |
738 | bool |
792 | bool |
739 | bgPixmap_t::set_shade (const char *shade_str) |
793 | bgPixmap_t::set_shade (const char *shade_str) |
740 | { |
794 | { |
741 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
795 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
742 | |
796 | |
|
|
797 | if (new_shade < 0 && new_shade > -100) |
|
|
798 | new_shade = 200 - (100 + new_shade); |
743 | if (new_shade == 100) |
799 | else if (new_shade == 100) |
744 | new_shade = 0; |
800 | new_shade = 0; |
745 | |
801 | |
746 | if (new_shade != shade) |
802 | if (new_shade != shade) |
747 | { |
803 | { |
748 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
804 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
… | |
… | |
751 | return true; |
807 | return true; |
752 | } |
808 | } |
753 | return false; |
809 | return false; |
754 | } |
810 | } |
755 | |
811 | |
756 | /* make_transparency_pixmap() |
812 | /* make_transparency_pixmap() |
757 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
813 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
758 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
814 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
759 | * our window. |
815 | * our window. |
760 | */ |
816 | */ |
761 | unsigned long |
817 | unsigned long |
762 | bgPixmap_t::make_transparency_pixmap () |
818 | bgPixmap_t::make_transparency_pixmap () |
763 | { |
819 | { |
… | |
… | |
862 | else |
918 | else |
863 | {/* strightforward pixmap copy */ |
919 | {/* strightforward pixmap copy */ |
864 | gcv.tile = root_pixmap; |
920 | gcv.tile = root_pixmap; |
865 | gcv.fill_style = FillTiled; |
921 | gcv.fill_style = FillTiled; |
866 | |
922 | |
867 | while (sx < 0) sx += (int)window_width; |
923 | while (sx < 0) sx += (int)root_width; |
868 | while (sy < 0) sy += (int)window_height; |
924 | while (sy < 0) sy += (int)root_height; |
869 | |
925 | |
870 | gcv.ts_x_origin = -sx; |
926 | gcv.ts_x_origin = -sx; |
871 | gcv.ts_y_origin = -sy; |
927 | gcv.ts_y_origin = -sy; |
872 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
928 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
873 | |
929 | |
… | |
… | |
879 | } |
935 | } |
880 | TIMING_TEST_PRINT_RESULT (tp); |
936 | TIMING_TEST_PRINT_RESULT (tp); |
881 | |
937 | |
882 | if (tiled_root_pmap != None) |
938 | if (tiled_root_pmap != None) |
883 | { |
939 | { |
884 | if (!need_client_side_rendering ()) |
940 | if (!need_client_side_rendering ()) |
885 | { |
941 | { |
886 | if ((flags & tintNeeded)) |
942 | if ((flags & tintNeeded)) |
887 | { |
943 | { |
888 | if (flags & tintWholesome) |
944 | if (flags & tintWholesome) |
889 | { |
945 | { |
890 | /* In this case we can tint image server-side getting significant |
946 | /* In this case we can tint image server-side getting significant |
891 | * performance improvements, as we eliminate XImage transfer |
947 | * performance improvements, as we eliminate XImage transfer |
… | |
… | |
932 | pf.direct.greenMask = 0xff; |
988 | pf.direct.greenMask = 0xff; |
933 | pf.direct.blueMask = 0xff; |
989 | pf.direct.blueMask = 0xff; |
934 | pf.direct.alphaMask = 0xff; |
990 | pf.direct.alphaMask = 0xff; |
935 | |
991 | |
936 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
992 | XRenderPictFormat *solid_format = XRenderFindFormat (dpy, |
937 | (PictFormatType| |
993 | (PictFormatType| |
938 | PictFormatDepth| |
994 | PictFormatDepth| |
939 | PictFormatRedMask| |
995 | PictFormatRedMask| |
940 | PictFormatGreenMask| |
996 | PictFormatGreenMask| |
941 | PictFormatBlueMask| |
997 | PictFormatBlueMask| |
942 | PictFormatAlphaMask), |
998 | PictFormatAlphaMask), |
943 | &pf, |
999 | &pf, |
944 | 0); |
1000 | 0); |
945 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
1001 | XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); |
946 | XRenderPictureAttributes pa ; |
1002 | XRenderPictureAttributes pa ; |
947 | |
1003 | |
948 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
1004 | back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); |
949 | |
1005 | |
… | |
… | |
951 | |
1007 | |
952 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1008 | Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
953 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
1009 | Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); |
954 | XFreePixmap (dpy, overlay_pmap); |
1010 | XFreePixmap (dpy, overlay_pmap); |
955 | |
1011 | |
956 | pa.component_alpha = True; |
1012 | pa.component_alpha = True; |
957 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
1013 | Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); |
958 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
1014 | Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); |
959 | XFreePixmap (dpy, mask_pmap); |
1015 | XFreePixmap (dpy, mask_pmap); |
960 | |
1016 | |
961 | if (mask_pic && overlay_pic && back_pic) |
1017 | if (mask_pic && overlay_pic && back_pic) |
… | |
… | |
977 | XRenderFreePicture (dpy, mask_pic); |
1033 | XRenderFreePicture (dpy, mask_pic); |
978 | XRenderFreePicture (dpy, overlay_pic); |
1034 | XRenderFreePicture (dpy, overlay_pic); |
979 | XRenderFreePicture (dpy, back_pic); |
1035 | XRenderFreePicture (dpy, back_pic); |
980 | # if DO_TIMING_TEST |
1036 | # if DO_TIMING_TEST |
981 | XSync (dpy, False); |
1037 | XSync (dpy, False); |
982 | # endif |
1038 | # endif |
983 | # endif |
1039 | # endif |
984 | } |
1040 | } |
985 | } |
1041 | } |
986 | } /* server side rendering completed */ |
1042 | } /* server side rendering completed */ |
987 | |
1043 | |
… | |
… | |
991 | pixmap = tiled_root_pmap; |
1047 | pixmap = tiled_root_pmap; |
992 | pmap_width = window_width; |
1048 | pmap_width = window_width; |
993 | pmap_height = window_height; |
1049 | pmap_height = window_height; |
994 | pmap_depth = root_depth; |
1050 | pmap_depth = root_depth; |
995 | } |
1051 | } |
996 | |
1052 | |
997 | if (gc) |
1053 | if (gc) |
998 | XFreeGC (dpy, gc); |
1054 | XFreeGC (dpy, gc); |
999 | |
1055 | |
1000 | TIMING_TEST_PRINT_RESULT (tp); |
1056 | TIMING_TEST_PRINT_RESULT (tp); |
1001 | |
1057 | |
1002 | return result; |
1058 | return result; |
1003 | } |
1059 | } |
1004 | |
1060 | |
1005 | bool |
1061 | bool |
1006 | bgPixmap_t::set_root_pixmap () |
1062 | bgPixmap_t::set_root_pixmap () |
1007 | { |
1063 | { |
1008 | Pixmap new_root_pixmap = None; |
1064 | Pixmap new_root_pixmap = None; |
1009 | |
1065 | |
1010 | new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1066 | new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1011 | if (new_root_pixmap == None) |
1067 | if (new_root_pixmap == None) |
1012 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1068 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1013 | |
1069 | |
1014 | if (new_root_pixmap != root_pixmap) |
1070 | if (new_root_pixmap != root_pixmap) |
… | |
… | |
1094 | } |
1150 | } |
1095 | else if (background_flags && pmap_depth != target->depth) |
1151 | else if (background_flags && pmap_depth != target->depth) |
1096 | { |
1152 | { |
1097 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1153 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1098 | } |
1154 | } |
|
|
1155 | |
1099 | # else /* our own client-side tinting */ |
1156 | # elif !XFT /* our own client-side tinting */ |
|
|
1157 | |
|
|
1158 | /* ATTENTION: We ASSUME that XFT will let us do all the tinting neccessary server-side. |
|
|
1159 | This may need to be changed in need_client_side_rendering() logic is altered !!! */ |
|
|
1160 | |
1100 | if (background_flags && (flags & isInvalid)) |
1161 | if (background_flags && (flags & isInvalid)) |
1101 | { |
1162 | { |
1102 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1163 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1103 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1164 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1104 | { |
1165 | { |
… | |
… | |
1157 | |
1218 | |
1158 | apply (); |
1219 | apply (); |
1159 | |
1220 | |
1160 | TIMING_TEST_PRINT_RESULT (tp); |
1221 | TIMING_TEST_PRINT_RESULT (tp); |
1161 | |
1222 | |
1162 | return true; |
1223 | return true; |
1163 | } |
1224 | } |
1164 | |
1225 | |
1165 | bool |
1226 | bool |
1166 | bgPixmap_t::set_target (rxvt_term *new_target) |
1227 | bgPixmap_t::set_target (rxvt_term *new_target) |
1167 | { |
1228 | { |
1168 | if (new_target) |
1229 | if (new_target) |
1169 | if (target != new_target) |
1230 | if (target != new_target) |
1170 | { |
1231 | { |
… | |
… | |
1217 | # if HAVE_SCROLLBARS |
1278 | # if HAVE_SCROLLBARS |
1218 | if (target->scrollBar.win) |
1279 | if (target->scrollBar.win) |
1219 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1280 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
1220 | # endif |
1281 | # endif |
1221 | } |
1282 | } |
1222 | |
1283 | /* don't want Expose on the parent or vt. It is better to use |
1223 | /* don't want Expose on the parent */ |
1284 | scr_touch or we get a great deal of flicker otherwise: */ |
1224 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); |
1285 | XClearWindow (target->dpy, target->parent[0]); |
1225 | /* do want Expose on the vt, so we get refreshed properly */ |
|
|
1226 | XClearArea (target->dpy, target->vt, 0, 0, 0, 0, True); |
|
|
1227 | |
1286 | |
1228 | # if HAVE_SCROLLBARS |
1287 | # if HAVE_SCROLLBARS |
1229 | if (target->scrollBar.win) |
1288 | if (target->scrollBar.win) |
1230 | { |
1289 | { |
1231 | target->scrollBar.setIdle (); |
1290 | target->scrollBar.setIdle (); |
1232 | target->scrollbar_show (0); |
1291 | target->scrollbar_show (0); |
1233 | } |
1292 | } |
1234 | # endif |
1293 | # endif |
1235 | } |
|
|
1236 | } |
|
|
1237 | |
1294 | |
|
|
1295 | target->want_refresh = 1; |
|
|
1296 | flags |= hasChanged; |
|
|
1297 | } |
|
|
1298 | } |
|
|
1299 | |
1238 | #endif /* HAVE_BG_PIXMAP */ |
1300 | #endif /* HAVE_BG_PIXMAP */ |
1239 | |
1301 | |
1240 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1302 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1241 | /* taken from aterm-0.4.2 */ |
1303 | /* taken from aterm-0.4.2 */ |
1242 | |
1304 | |
1243 | typedef uint32_t RUINT32T; |
1305 | typedef uint32_t RUINT32T; |
1244 | |
1306 | |
1245 | static void |
1307 | static void |