… | |
… | |
72 | |
72 | |
73 | #ifdef HAVE_BG_PIXMAP |
73 | #ifdef HAVE_BG_PIXMAP |
74 | bool |
74 | bool |
75 | bgPixmap_t::window_size_sensitive () |
75 | bgPixmap_t::window_size_sensitive () |
76 | { |
76 | { |
77 | #ifdef XPM_BACKGROUND |
77 | # ifdef XPM_BACKGROUND |
78 | #ifdef HAVE_AFTERIMAGE |
78 | # ifdef HAVE_AFTERIMAGE |
79 | if (original_asim != NULL) |
79 | if (original_asim != NULL) |
80 | #endif |
80 | # endif |
81 | { |
81 | { |
82 | if (h_scale != 0 || v_scale != 0) |
82 | if (h_scale != 0 || v_scale != 0) |
83 | return true; |
83 | return true; |
84 | } |
84 | } |
85 | #endif |
85 | # endif |
86 | #ifdef ENABLE_TRANSPARENCY |
86 | # ifdef ENABLE_TRANSPARENCY |
87 | if (flags & bgPmap_Transparent) |
87 | if (flags & isTransparent) |
88 | return true; |
88 | return true; |
89 | #endif |
89 | # endif |
90 | return false; |
90 | return false; |
91 | } |
91 | } |
92 | |
92 | |
93 | #ifdef XPM_BACKGROUND |
93 | # ifdef XPM_BACKGROUND |
94 | static inline bool |
94 | static inline bool |
95 | check_set_scale_value (int geom_flags, int flag, unsigned int &scale, unsigned int new_value) |
95 | check_set_scale_value (int geom_flags, int flag, unsigned int &scale, unsigned int new_value) |
96 | { |
96 | { |
97 | if (geom_flags & flag) |
97 | if (geom_flags & flag) |
98 | { |
98 | { |
… | |
… | |
160 | dst_size = target_size - dst_pos; |
160 | dst_size = target_size - dst_pos; |
161 | return src_pos; |
161 | return src_pos; |
162 | } |
162 | } |
163 | |
163 | |
164 | bool |
164 | bool |
165 | bgPixmap_t::handle_geometry (const char *geom) |
165 | bgPixmap_t::set_geometry (const char *geom) |
166 | { |
166 | { |
167 | int geom_flags = 0, changed = 0; |
167 | int geom_flags = 0, changed = 0; |
168 | int x = 0, y = 0; |
168 | int x = 0, y = 0; |
169 | unsigned int w = 0, h = 0; |
169 | unsigned int w = 0, h = 0; |
170 | unsigned int n; |
170 | unsigned int n; |
171 | unsigned long new_flags = (flags&(~bgPmap_geometryFlags)); |
171 | unsigned long new_flags = (flags & (~geometryFlags)); |
172 | char *p; |
172 | char *p; |
173 | #define MAXLEN_GEOM 256 /* could be longer then regular geometry string */ |
173 | # define MAXLEN_GEOM 256 /* could be longer then regular geometry string */ |
174 | |
174 | |
175 | if (geom == NULL) |
175 | if (geom == NULL) |
176 | return false; |
176 | return false; |
177 | |
177 | |
178 | char str[MAXLEN_GEOM]; |
178 | char str[MAXLEN_GEOM]; |
179 | |
179 | |
180 | if (!strcmp (geom, "?")) |
|
|
181 | { |
|
|
182 | #if 0 /* TODO: */ |
|
|
183 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
|
|
184 | min (h_scale, 32767), min (v_scale, 32767), |
|
|
185 | min (h_align, 32767), min (v_align, 32767)); |
|
|
186 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
|
|
187 | #endif |
|
|
188 | return false; |
|
|
189 | } |
|
|
190 | while (isspace(*geom)) ++geom; |
180 | while (isspace(*geom)) ++geom; |
191 | if ((p = strchr (geom, ';')) == NULL) |
181 | if ((p = strchr (geom, ';')) == NULL) |
192 | p = strchr (geom, '\0'); |
182 | p = strchr (geom, '\0'); |
193 | |
183 | |
194 | n = (p - geom); |
184 | n = (p - geom); |
195 | if (n < MAXLEN_GEOM) |
185 | if (n < MAXLEN_GEOM) |
196 | { |
186 | { |
197 | char *ops; |
187 | char *ops; |
198 | new_flags |= bgPmap_geometrySet; |
188 | new_flags |= geometrySet; |
199 | |
189 | |
200 | strncpy (str, geom, n); |
190 | strncpy (str, geom, n); |
201 | str[n] = '\0'; |
191 | str[n] = '\0'; |
202 | if (str[0] == ':') |
192 | if (str[0] == ':') |
203 | ops = &str[0]; |
193 | ops = &str[0]; |
… | |
… | |
224 | { |
214 | { |
225 | y = x; |
215 | y = x; |
226 | geom_flags |= YValue; |
216 | geom_flags |= YValue; |
227 | } |
217 | } |
228 | |
218 | |
229 | if (flags & bgPmap_geometrySet) |
219 | if (flags & geometrySet) |
230 | {/* new geometry is an adjustment to the old one ! */ |
220 | {/* new geometry is an adjustment to the old one ! */ |
231 | if ((geom_flags & WidthValue) && (geom_flags & HeightValue)) |
221 | if ((geom_flags & WidthValue) && (geom_flags & HeightValue)) |
232 | { |
222 | { |
233 | if (w == 0 && h != 0) |
223 | if (w == 0 && h != 0) |
234 | { |
224 | { |
… | |
… | |
252 | } |
242 | } |
253 | else /* setting up geometry from scratch */ |
243 | else /* setting up geometry from scratch */ |
254 | { |
244 | { |
255 | if (!(geom_flags & XValue)) |
245 | if (!(geom_flags & XValue)) |
256 | {/* use default geometry - centered */ |
246 | {/* use default geometry - centered */ |
257 | x = y = bgPmap_defaultAlign; |
247 | x = y = defaultAlign; |
258 | } |
248 | } |
259 | else if (!(geom_flags & YValue)) |
249 | else if (!(geom_flags & YValue)) |
260 | y = x; |
250 | y = x; |
261 | |
251 | |
262 | if ((geom_flags & (WidthValue|HeightValue)) == 0) |
252 | if ((geom_flags & (WidthValue|HeightValue)) == 0) |
263 | {/* use default geometry - scaled */ |
253 | {/* use default geometry - scaled */ |
264 | w = h = bgPmap_defaultScale; |
254 | w = h = defaultScale; |
265 | } |
255 | } |
266 | else if (geom_flags & WidthValue) |
256 | else if (geom_flags & WidthValue) |
267 | { |
257 | { |
268 | if (!(geom_flags & HeightValue)) |
258 | if (!(geom_flags & HeightValue)) |
269 | h = w; |
259 | h = w; |
270 | } |
260 | } |
271 | else |
261 | else |
272 | w = h; |
262 | w = h; |
273 | } |
263 | } |
274 | } /* done parsing geometry string */ |
264 | } /* done parsing geometry string */ |
275 | else if (!(flags & bgPmap_geometrySet)) |
265 | else if (!(flags & geometrySet)) |
276 | { /* default geometry - scaled and centered */ |
266 | { /* default geometry - scaled and centered */ |
277 | x = y = bgPmap_defaultAlign; |
267 | x = y = defaultAlign; |
278 | w = h = bgPmap_defaultScale; |
268 | w = h = defaultScale; |
279 | } |
269 | } |
280 | |
270 | |
281 | if (!(flags & bgPmap_geometrySet)) |
271 | if (!(flags & geometrySet)) |
282 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
272 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
283 | |
273 | |
284 | if (ops) |
274 | if (ops) |
285 | { |
275 | { |
286 | while (*ops) |
276 | while (*ops) |
287 | { |
277 | { |
288 | while (*ops == ':' || isspace(*ops)) ++ops; |
278 | while (*ops == ':' || isspace(*ops)) ++ops; |
289 | #define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
279 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
290 | if (CHECK_GEOM_OPS("tile")) |
280 | if (CHECK_GEOM_OPS("tile")) |
291 | { |
281 | { |
292 | w = h = 0; |
282 | w = h = 0; |
293 | geom_flags |= WidthValue|HeightValue; |
283 | geom_flags |= WidthValue|HeightValue; |
294 | } |
284 | } |
… | |
… | |
297 | if (w == 0 && h == 0) |
287 | if (w == 0 && h == 0) |
298 | { |
288 | { |
299 | w = 100; |
289 | w = 100; |
300 | geom_flags |= WidthValue; |
290 | geom_flags |= WidthValue; |
301 | } |
291 | } |
302 | new_flags |= bgPmap_propScale; |
292 | new_flags |= propScale; |
303 | } |
293 | } |
304 | else if (CHECK_GEOM_OPS("hscale")) |
294 | else if (CHECK_GEOM_OPS("hscale")) |
305 | { |
295 | { |
306 | if (w == 0) |
296 | if (w == 0) |
307 | w = 100; |
297 | w = 100; |
… | |
… | |
327 | { |
317 | { |
328 | w = h = 100; |
318 | w = h = 100; |
329 | x = y = 50; |
319 | x = y = 50; |
330 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
320 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
331 | } |
321 | } |
332 | #undef CHECK_GEOM_OPS |
322 | # undef CHECK_GEOM_OPS |
333 | while (*ops != ':' && *ops != '\0') ++ops; |
323 | while (*ops != ':' && *ops != '\0') ++ops; |
334 | } /* done parsing ops */ |
324 | } /* done parsing ops */ |
335 | } |
325 | } |
336 | |
326 | |
337 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) |
327 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) |
… | |
… | |
352 | //fprintf( stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
342 | //fprintf( stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
353 | // flags, h_scale, v_scale, h_align, v_align); |
343 | // flags, h_scale, v_scale, h_align, v_align); |
354 | return (changed > 0); |
344 | return (changed > 0); |
355 | } |
345 | } |
356 | |
346 | |
357 | #ifdef HAVE_AFTERIMAGE |
347 | # ifdef HAVE_AFTERIMAGE |
358 | bool |
348 | bool |
359 | bgPixmap_t::render_asim (rxvt_term *target, ASImage *background, ARGB32 background_tint) |
349 | bgPixmap_t::render_asim (ASImage *background, ARGB32 background_tint) |
360 | { |
350 | { |
361 | if (target == NULL) |
351 | if (target == NULL) |
362 | return false; |
352 | return false; |
363 | |
353 | |
364 | int target_width = (int)target->szHint.width; |
354 | int target_width = (int)target->szHint.width; |
… | |
… | |
536 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
526 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
537 | |
527 | |
538 | if (result != background && result != original_asim) |
528 | if (result != background && result != original_asim) |
539 | destroy_asimage (&result); |
529 | destroy_asimage (&result); |
540 | |
530 | |
541 | /* set target's background to pixmap */ |
|
|
542 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
|
|
543 | |
|
|
544 | XFreeGC (target->dpy, gc); |
531 | XFreeGC (target->dpy, gc); |
545 | } |
532 | } |
546 | else |
|
|
547 | { |
|
|
548 | /* set target background to a pixel */ |
|
|
549 | XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]); |
|
|
550 | } |
|
|
551 | |
533 | |
552 | return true; |
534 | return true; |
553 | } |
535 | } |
554 | #endif |
536 | # endif /* HAVE_AFTERIMAGE */ |
555 | |
537 | |
556 | void |
538 | bool |
557 | rxvt_term::resize_pixmap () |
539 | bgPixmap_t::set_file (const char *file) |
558 | { |
|
|
559 | |
|
|
560 | #ifdef ENABLE_TRANSPARENCY |
|
|
561 | if (option(Opt_transparent) && am_transparent) |
|
|
562 | { |
|
|
563 | /* we need to re-generate transparency pixmap in that case ! */ |
|
|
564 | check_our_parents (); |
|
|
565 | return; |
|
|
566 | } |
|
|
567 | #endif |
|
|
568 | #ifdef HAVE_AFTERIMAGE |
|
|
569 | bgPixmap.render_asim(this, NULL, TINT_LEAVE_SAME); |
|
|
570 | #endif |
|
|
571 | } |
|
|
572 | |
|
|
573 | void |
|
|
574 | rxvt_term::set_bgPixmap (const char *file) |
|
|
575 | { |
540 | { |
576 | char *f; |
541 | char *f; |
577 | |
542 | |
578 | assert (file != NULL); |
543 | assert (file != NULL); |
579 | |
544 | |
580 | if (bgPixmap.pixmap != None) |
|
|
581 | { |
|
|
582 | XFreePixmap (dpy, bgPixmap.pixmap); |
|
|
583 | bgPixmap.pixmap = None; |
|
|
584 | } |
|
|
585 | |
|
|
586 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
|
|
587 | if (*file != '\0') |
545 | if (*file != '\0') |
588 | { |
546 | { |
589 | #ifdef HAVE_AFTERIMAGE |
547 | # ifdef HAVE_AFTERIMAGE |
590 | if (asimman == NULL) |
548 | if (target->asimman == NULL) |
591 | asimman = create_generic_imageman(rs[Rs_path]); |
549 | target->asimman = create_generic_imageman(target->rs[Rs_path]); |
592 | if ((f = strchr (file, ';')) == NULL) |
550 | if ((f = strchr (file, ';')) == NULL) |
593 | bgPixmap.original_asim = get_asimage( asimman, file, 0xFFFFFFFF, 100 ); |
551 | original_asim = get_asimage( target->asimman, file, 0xFFFFFFFF, 100 ); |
594 | else |
552 | else |
595 | { |
553 | { |
596 | size_t len = f - file; |
554 | size_t len = f - file; |
597 | f = (char *)malloc (len + 1); |
555 | f = (char *)malloc (len + 1); |
598 | strncpy (f, file, len); |
556 | strncpy (f, file, len); |
599 | f[len] = '\0'; |
557 | f[len] = '\0'; |
600 | bgPixmap.original_asim = get_asimage( asimman, f, 0xFFFFFFFF, 100 ); |
558 | original_asim = get_asimage( target->asimman, f, 0xFFFFFFFF, 100 ); |
601 | free( f ); |
559 | free( f ); |
602 | } |
560 | } |
|
|
561 | return (original_asim != NULL); |
603 | #endif |
562 | # endif |
604 | } |
563 | } |
605 | resize_pixmap (); /* TODO: temporary fix - should be done by the caller! */ |
564 | return false; |
606 | } |
565 | } |
607 | |
566 | |
608 | #endif /* XPM_BACKGROUND */ |
567 | # endif /* XPM_BACKGROUND */ |
|
|
568 | |
|
|
569 | # ifdef ENABLE_TRANSPARENCY |
|
|
570 | bool |
|
|
571 | bgPixmap_t::set_transparent () |
|
|
572 | { |
|
|
573 | if (!(flags & isTransparent)) |
|
|
574 | { |
|
|
575 | flags |= isTransparent; |
|
|
576 | return true; |
|
|
577 | } |
|
|
578 | } |
|
|
579 | |
|
|
580 | bool |
|
|
581 | bgPixmap_t::set_blur_radius (const char *geom) |
|
|
582 | { |
|
|
583 | int changed = 0; |
|
|
584 | unsigned int hr, vr; |
|
|
585 | int junk; |
|
|
586 | int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); |
|
|
587 | if (!(geom_flags&WidthValue)) |
|
|
588 | hr = 1; |
|
|
589 | if (!(geom_flags&HeightValue)) |
|
|
590 | vr = hr; |
|
|
591 | |
|
|
592 | if (h_blurRadius != hr) |
|
|
593 | { |
|
|
594 | ++changed; |
|
|
595 | h_blurRadius = hr; |
|
|
596 | } |
|
|
597 | if (v_blurRadius != vr) |
|
|
598 | { |
|
|
599 | ++changed; |
|
|
600 | v_blurRadius = vr; |
|
|
601 | } |
|
|
602 | return (changed>0); |
|
|
603 | } |
|
|
604 | |
|
|
605 | static inline unsigned long |
|
|
606 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
|
|
607 | { |
|
|
608 | unsigned long flags = 0; |
|
|
609 | |
|
|
610 | if (shade > 0 && shade <100) |
|
|
611 | flags |= bgPixmap_t::tintNeeded; |
|
|
612 | else if (tint) |
|
|
613 | { |
|
|
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) |
|
|
619 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
|
|
620 | { |
|
|
621 | 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 | } |
|
|
629 | } |
|
|
630 | return flags; |
|
|
631 | } |
|
|
632 | |
|
|
633 | bool |
|
|
634 | bgPixmap_t::set_tint (rxvt_color &new_tint) |
|
|
635 | { |
|
|
636 | if (tint != new_tint) |
|
|
637 | { |
|
|
638 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
|
|
639 | tint = new_tint; |
|
|
640 | flags = (flags & ~tintFlags) | new_flags | tintSet; |
|
|
641 | return true; |
|
|
642 | } |
|
|
643 | return false; |
|
|
644 | } |
|
|
645 | |
|
|
646 | bool |
|
|
647 | bgPixmap_t::unset_tint () |
|
|
648 | { |
|
|
649 | unsigned long new_flags = compute_tint_shade_flags (NULL, shade); |
|
|
650 | |
|
|
651 | if (new_flags != (flags & tintFlags)) |
|
|
652 | { |
|
|
653 | flags = (flags&~tintFlags)|new_flags; |
|
|
654 | return true; |
|
|
655 | } |
|
|
656 | return false; |
|
|
657 | } |
|
|
658 | |
|
|
659 | bool |
|
|
660 | bgPixmap_t::set_shade (const char *shade_str) |
|
|
661 | { |
|
|
662 | int new_shade = (shade_str) ? atoi (shade_str) : 0; |
|
|
663 | |
|
|
664 | if (new_shade == 100) |
|
|
665 | new_shade = 0; |
|
|
666 | |
|
|
667 | if (new_shade != shade) |
|
|
668 | { |
|
|
669 | unsigned long new_flags = compute_tint_shade_flags (&tint, new_shade); |
|
|
670 | shade = new_shade; |
|
|
671 | flags = (flags & ~tintFlags) | new_flags; |
|
|
672 | return true; |
|
|
673 | } |
|
|
674 | return false; |
|
|
675 | } |
|
|
676 | |
|
|
677 | |
|
|
678 | /* make_transparency_pixmap() |
|
|
679 | * 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 |
|
|
681 | * our window. |
|
|
682 | */ |
|
|
683 | unsigned long |
|
|
684 | bgPixmap_t::make_transparency_pixmap () |
|
|
685 | { |
|
|
686 | unsigned long result = 0; |
|
|
687 | |
|
|
688 | if (target == NULL) |
|
|
689 | return 0; |
|
|
690 | |
|
|
691 | /* root dimentions may change from call to call - but Display structure should |
|
|
692 | * be always up-to-date, so let's use it : |
|
|
693 | */ |
|
|
694 | Window root = target->display->root; |
|
|
695 | int screen = target->display->screen; |
|
|
696 | Display *dpy = target->dpy; |
|
|
697 | int root_width = DisplayWidth (dpy, screen); |
|
|
698 | int root_height = DisplayHeight (dpy, screen); |
|
|
699 | unsigned int root_pmap_width, root_pmap_height; |
|
|
700 | int window_width = target->szHint.width; |
|
|
701 | int window_height = target->szHint.height; |
|
|
702 | int sx, sy; |
|
|
703 | XGCValues gcv; |
|
|
704 | |
|
|
705 | target->get_window_origin (sx, sy); |
|
|
706 | |
|
|
707 | /* check if we are outside of the visible part of the virtual screen : */ |
|
|
708 | if (sx + window_width <= 0 || sy + window_height <= 0 |
|
|
709 | || sx >= root_width || sy >= root_height) |
|
|
710 | return 0; |
|
|
711 | |
|
|
712 | if (root_pixmap != None) |
|
|
713 | {/* we want to validate the pixmap and get it's size at the same time : */ |
|
|
714 | int junk; |
|
|
715 | unsigned int ujunk; |
|
|
716 | /* root pixmap may be bad - allow a error */ |
|
|
717 | target->allowedxerror = -1; |
|
|
718 | if (!XGetGeometry (dpy, root_pixmap, &root, &junk, &junk, &root_pmap_width, &root_pmap_height, &ujunk, &ujunk)) |
|
|
719 | root_pixmap = None; |
|
|
720 | target->allowedxerror = 0; |
|
|
721 | } |
|
|
722 | |
|
|
723 | Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); |
|
|
724 | GC gc = NULL; |
|
|
725 | |
|
|
726 | if (tiled_root_pmap == None) /* something really bad happened - abort */ |
|
|
727 | return 0; |
|
|
728 | |
|
|
729 | if (root_pixmap == None) |
|
|
730 | { /* use tricks to obtain the root background image :*/ |
|
|
731 | /* we want to create Overrideredirect window overlapping out window |
|
|
732 | with background type of Parent Relative and then grab it */ |
|
|
733 | XSetWindowAttributes attr; |
|
|
734 | Window src; |
|
|
735 | bool success = false; |
|
|
736 | |
|
|
737 | attr.background_pixmap = ParentRelative; |
|
|
738 | attr.backing_store = Always; |
|
|
739 | attr.event_mask = ExposureMask; |
|
|
740 | attr.override_redirect = True; |
|
|
741 | src = XCreateWindow (dpy, root, sx, sy, window_width, window_height, 0, |
|
|
742 | CopyFromParent, CopyFromParent, CopyFromParent, |
|
|
743 | CWBackPixmap|CWBackingStore|CWOverrideRedirect|CWEventMask, |
|
|
744 | &attr); |
|
|
745 | |
|
|
746 | if (src != None) |
|
|
747 | { |
|
|
748 | XEvent event; |
|
|
749 | int ev_count = 0; |
|
|
750 | XGrabServer (dpy); |
|
|
751 | XMapRaised (dpy, src); |
|
|
752 | XSync (dpy, False); |
|
|
753 | /* 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 : */ |
|
|
755 | while (XCheckWindowEvent (dpy, src, ExposureMask, &event)) |
|
|
756 | ++ev_count; |
|
|
757 | if (ev_count > 0); |
|
|
758 | { /* hooray! - we can grab the image! */ |
|
|
759 | gc = XCreateGC (dpy, root, 0, NULL); |
|
|
760 | if (gc) |
|
|
761 | { |
|
|
762 | XCopyArea (dpy, src, tiled_root_pmap, gc, 0, 0, window_width, window_height, 0, 0); |
|
|
763 | success = true; |
|
|
764 | } |
|
|
765 | } |
|
|
766 | XDestroyWindow (dpy, src); |
|
|
767 | XUngrabServer (dpy); |
|
|
768 | //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count); |
|
|
769 | } |
|
|
770 | if (!success) |
|
|
771 | { |
|
|
772 | XFreePixmap (dpy, tiled_root_pmap); |
|
|
773 | tiled_root_pmap = None; |
|
|
774 | } |
|
|
775 | else |
|
|
776 | result |= transpPmapTiled; |
|
|
777 | } |
|
|
778 | else |
|
|
779 | {/* strightforward pixmap copy */ |
|
|
780 | gcv.tile = root_pixmap; |
|
|
781 | gcv.fill_style = FillTiled; |
|
|
782 | while (sx < 0) sx += (int)window_width; |
|
|
783 | while (sy < 0) sy += (int)window_height; |
|
|
784 | gcv.ts_x_origin = -sx; |
|
|
785 | gcv.ts_y_origin = -sy; |
|
|
786 | gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
|
|
787 | if (gc) |
|
|
788 | { |
|
|
789 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
|
|
790 | result |= transpPmapTiled; |
|
|
791 | } |
|
|
792 | } |
|
|
793 | |
|
|
794 | if (tiled_root_pmap != None) |
|
|
795 | { |
|
|
796 | if (flags & tintNeeded) |
|
|
797 | { |
|
|
798 | if ((flags & tintServerSide) |
|
|
799 | && h_blurRadius <= 1 && v_blurRadius <= 1 |
|
|
800 | # ifdef HAVE_AFTERIMAGE |
|
|
801 | && original_asim == NULL |
|
|
802 | # endif |
|
|
803 | ) |
|
|
804 | { /* In this case we can tint image server-side getting significant |
|
|
805 | * performance improvements, as we eliminate XImage transfer |
|
|
806 | */ |
|
|
807 | gcv.foreground = Pixel (tint); |
|
|
808 | gcv.function = GXand; |
|
|
809 | gcv.fill_style = FillSolid; |
|
|
810 | if (gc) |
|
|
811 | XChangeGC (dpy, gc, GCFillStyle | GCForeground | GCFunction, &gcv); |
|
|
812 | else |
|
|
813 | gc = XCreateGC (dpy, root, GCFillStyle | GCForeground | GCFunction, &gcv); |
|
|
814 | if (gc) |
|
|
815 | { |
|
|
816 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
|
|
817 | result |= transpPmapTinted; |
|
|
818 | } |
|
|
819 | } |
|
|
820 | } |
|
|
821 | if (pixmap) |
|
|
822 | XFreePixmap (dpy, pixmap); |
|
|
823 | pixmap = tiled_root_pmap; |
|
|
824 | pmap_width = window_width; |
|
|
825 | pmap_height = window_height; |
|
|
826 | pmap_depth = root_depth; |
|
|
827 | } |
|
|
828 | |
|
|
829 | if (gc) |
|
|
830 | XFreeGC (dpy, gc); |
|
|
831 | |
|
|
832 | return result; |
|
|
833 | } |
|
|
834 | |
|
|
835 | bool |
|
|
836 | bgPixmap_t::set_root_pixmap () |
|
|
837 | { |
|
|
838 | Pixmap new_root_pixmap = None; |
|
|
839 | |
|
|
840 | new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
|
|
841 | if (new_root_pixmap == None) |
|
|
842 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
|
|
843 | |
|
|
844 | if (new_root_pixmap != root_pixmap) |
|
|
845 | { |
|
|
846 | root_pixmap = new_root_pixmap; |
|
|
847 | return true; |
|
|
848 | } |
|
|
849 | return false; |
|
|
850 | } |
|
|
851 | # endif /* ENABLE_TRANSPARENCY */ |
|
|
852 | |
|
|
853 | # ifndef HAVE_AFTERIMAGE |
|
|
854 | static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); |
|
|
855 | #endif |
|
|
856 | |
|
|
857 | |
|
|
858 | bool |
|
|
859 | bgPixmap_t::render () |
|
|
860 | { |
|
|
861 | unsigned long background_flags = 0; |
|
|
862 | |
|
|
863 | if (target == NULL) |
|
|
864 | return false; |
|
|
865 | |
|
|
866 | invalidate(); |
|
|
867 | # ifdef ENABLE_TRANSPARENCY |
|
|
868 | if (flags & isTransparent) |
|
|
869 | { |
|
|
870 | /* we need to re-generate transparency pixmap in that case ! */ |
|
|
871 | background_flags = make_transparency_pixmap (); |
|
|
872 | if (background_flags == 0) |
|
|
873 | return false; |
|
|
874 | else if ((background_flags & transpTransformations) == (flags & transpTransformations) |
|
|
875 | && pmap_depth == target->depth) |
|
|
876 | flags = flags & ~isInvalid; |
|
|
877 | } |
|
|
878 | # endif |
|
|
879 | |
|
|
880 | XImage *result = NULL; |
|
|
881 | # ifdef HAVE_AFTERIMAGE |
|
|
882 | if (original_asim |
|
|
883 | || (background_flags & transpTransformations) != (flags & transpTransformations)) |
|
|
884 | { |
|
|
885 | ASImage *background = NULL; |
|
|
886 | ARGB32 as_tint = TINT_LEAVE_SAME; |
|
|
887 | if (background_flags) |
|
|
888 | background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); |
|
|
889 | |
|
|
890 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
|
|
891 | { |
|
|
892 | ShadingInfo as_shade; |
|
|
893 | as_shade.shading = (shade == 0) ? 100 : shade; |
|
|
894 | |
|
|
895 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
896 | if (flags & tintSet) |
|
|
897 | tint.get (c); |
|
|
898 | as_shade.tintColor.red = c.r; |
|
|
899 | as_shade.tintColor.green = c.g; |
|
|
900 | as_shade.tintColor.blue = c.b; |
|
|
901 | |
|
|
902 | as_tint = shading2tint32 (&as_shade); |
|
|
903 | } |
|
|
904 | if (render_asim (background, as_tint)) |
|
|
905 | flags = flags & ~isInvalid; |
|
|
906 | if (background) |
|
|
907 | destroy_asimage (&background); |
|
|
908 | } |
|
|
909 | else if (background_flags && pmap_depth != target->depth) |
|
|
910 | { |
|
|
911 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
|
|
912 | } |
|
|
913 | # else /* our own client-side tinting */ |
|
|
914 | if (background_flags && (flags & isInvalid)) |
|
|
915 | { |
|
|
916 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
|
|
917 | if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
|
|
918 | { |
|
|
919 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
|
|
920 | if (flags & tintSet) |
|
|
921 | tint.get (c); |
|
|
922 | ShadeXImage (target, result, shade, c.r, c.g, c.b); |
|
|
923 | } |
|
|
924 | } |
|
|
925 | # endif |
|
|
926 | if (result != NULL) |
|
|
927 | { |
|
|
928 | GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); |
|
|
929 | if (gc) |
|
|
930 | { |
|
|
931 | if (pmap_depth != target->depth && pixmap != None) |
|
|
932 | { |
|
|
933 | XFreePixmap (target->dpy, pixmap); |
|
|
934 | pixmap = None; |
|
|
935 | } |
|
|
936 | if (pixmap == None) |
|
|
937 | { |
|
|
938 | pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth); |
|
|
939 | pmap_width = result->width; |
|
|
940 | pmap_height = result->height; |
|
|
941 | pmap_depth = target->depth; |
|
|
942 | } |
|
|
943 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
|
|
944 | XFreeGC (target->dpy, gc); |
|
|
945 | flags = flags & ~isInvalid; |
|
|
946 | } |
|
|
947 | XDestroyImage (result); |
|
|
948 | } |
|
|
949 | |
|
|
950 | if (flags & isInvalid) |
|
|
951 | { |
|
|
952 | if (pixmap != None) |
|
|
953 | { |
|
|
954 | XFreePixmap (target->dpy, pixmap); |
|
|
955 | pixmap = None; |
|
|
956 | } |
|
|
957 | // TODO : we need to get rid of that garbadge : |
|
|
958 | target->am_transparent = target->am_pixmap_trans = 0; |
|
|
959 | } |
|
|
960 | else |
|
|
961 | target->am_transparent = target->am_pixmap_trans = 1; |
|
|
962 | |
|
|
963 | apply (); |
|
|
964 | |
|
|
965 | return true; |
|
|
966 | } |
|
|
967 | |
|
|
968 | bool |
|
|
969 | bgPixmap_t::set_target (rxvt_term *new_target) |
|
|
970 | { |
|
|
971 | if (new_target) |
|
|
972 | if (target != new_target) |
|
|
973 | { |
|
|
974 | target = new_target; |
|
|
975 | # ifdef ENABLE_TRANSPARENCY |
|
|
976 | root_depth = DefaultDepthOfScreen (ScreenOfDisplay (target->dpy, target->display->screen)); |
|
|
977 | # endif |
|
|
978 | return true; |
|
|
979 | } |
|
|
980 | return false; |
|
|
981 | } |
|
|
982 | |
|
|
983 | void |
|
|
984 | bgPixmap_t::apply() |
|
|
985 | { |
|
|
986 | if (target) |
|
|
987 | { |
|
|
988 | if (pixmap != None) |
|
|
989 | { /* set target's background to pixmap */ |
|
|
990 | # ifdef ENABLE_TRANSPARENCY |
|
|
991 | if (flags & isTransparent) |
|
|
992 | { |
|
|
993 | XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap); |
|
|
994 | XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative); |
|
|
995 | # if HAVE_SCROLLBARS |
|
|
996 | if (target->scrollBar.win) |
|
|
997 | XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); |
|
|
998 | # endif |
|
|
999 | } |
|
|
1000 | else |
|
|
1001 | # endif |
|
|
1002 | { |
|
|
1003 | /* force old pixmap dereference in case it was transparent before :*/ |
|
|
1004 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
|
|
1005 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
|
|
1006 | /* do we also need to set scrollbar's background here ? */ |
|
|
1007 | # if HAVE_SCROLLBARS |
|
|
1008 | if (target->scrollBar.win) |
|
|
1009 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
|
|
1010 | # endif |
|
|
1011 | } |
|
|
1012 | } |
|
|
1013 | else |
|
|
1014 | { /* set target background to a pixel */ |
|
|
1015 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
|
|
1016 | XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]); |
|
|
1017 | /* do we also need to set scrollbar's background here ? */ |
|
|
1018 | # if HAVE_SCROLLBARS |
|
|
1019 | if (target->scrollBar.win) |
|
|
1020 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
|
|
1021 | # endif |
|
|
1022 | } |
|
|
1023 | /* don't want Expose on the parent */ |
|
|
1024 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); |
|
|
1025 | /* do want Expose on the vt */ |
|
|
1026 | XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, True); |
|
|
1027 | #if HAVE_SCROLLBARS |
|
|
1028 | if (target->scrollBar.win) |
|
|
1029 | { |
|
|
1030 | target->scrollBar.setIdle (); |
|
|
1031 | target->scrollbar_show (0); |
|
|
1032 | } |
|
|
1033 | #endif |
|
|
1034 | target->want_refresh = target->want_full_refresh = 1; |
|
|
1035 | target->flush (); |
|
|
1036 | } |
|
|
1037 | } |
609 | #endif /* HAVE_BG_PIXMAP */ |
1038 | #endif /* HAVE_BG_PIXMAP */ |
|
|
1039 | |
|
|
1040 | |
|
|
1041 | void |
|
|
1042 | rxvt_term::get_window_origin (int &x, int &y) |
|
|
1043 | { |
|
|
1044 | Window cr; |
|
|
1045 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
|
|
1046 | } |
|
|
1047 | |
|
|
1048 | Pixmap |
|
|
1049 | rxvt_term::get_pixmap_property (int prop_id) |
|
|
1050 | { |
|
|
1051 | if (prop_id > 0 && prop_id < NUM_XA) |
|
|
1052 | if (xa[prop_id]) |
|
|
1053 | { |
|
|
1054 | int aformat, rootdepth; |
|
|
1055 | unsigned long nitems, bytes_after; |
|
|
1056 | Atom atype; |
|
|
1057 | unsigned char *prop = NULL; |
|
|
1058 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
|
|
1059 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
1060 | &nitems, &bytes_after, &prop); |
|
|
1061 | if (result == Success && prop && atype == XA_PIXMAP) |
|
|
1062 | { |
|
|
1063 | return *(Pixmap *)prop; |
|
|
1064 | } |
|
|
1065 | } |
|
|
1066 | return None; |
|
|
1067 | } |
|
|
1068 | |
610 | |
1069 | |
611 | #ifdef ENABLE_TRANSPARENCY |
1070 | #ifdef ENABLE_TRANSPARENCY |
612 | #ifndef HAVE_AFTERIMAGE |
1071 | #ifndef HAVE_AFTERIMAGE |
613 | /* taken from aterm-0.4.2 */ |
1072 | /* taken from aterm-0.4.2 */ |
614 | |
1073 | |
… | |
… | |
624 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
1083 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
625 | int i; |
1084 | int i; |
626 | |
1085 | |
627 | Visual *visual = term->visual; |
1086 | Visual *visual = term->visual; |
628 | |
1087 | |
629 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
1088 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return ; |
630 | |
1089 | |
|
|
1090 | if (shade == 0) |
|
|
1091 | shade = 100; |
|
|
1092 | |
631 | /* for convenience */ |
1093 | /* for convenience */ |
632 | mask_r = visual->red_mask; |
1094 | mask_r = visual->red_mask; |
633 | mask_g = visual->green_mask; |
1095 | mask_g = visual->green_mask; |
634 | mask_b = visual->blue_mask; |
1096 | mask_b = visual->blue_mask; |
635 | |
1097 | |
… | |
… | |
854 | } |
1316 | } |
855 | |
1317 | |
856 | void |
1318 | void |
857 | rxvt_term::check_our_parents_cb (time_watcher &w) |
1319 | rxvt_term::check_our_parents_cb (time_watcher &w) |
858 | { |
1320 | { |
|
|
1321 | #if 0 /* replaced by a bgPixmap_t::render() - leve here temporarily for reference */ |
|
|
1322 | |
859 | int i, pchanged, aformat, rootdepth; |
1323 | int i, aformat, rootdepth; |
860 | unsigned long nitems, bytes_after; |
1324 | unsigned long nitems, bytes_after; |
861 | Atom atype; |
1325 | Atom atype; |
862 | unsigned char *prop = NULL; |
1326 | unsigned char *prop = NULL; |
863 | Window root, oldp, *list; |
1327 | Window root, oldp, *list; |
864 | Pixmap rootpixmap = None; |
1328 | Pixmap rootpixmap = None; |
865 | XWindowAttributes wattr, wrootattr; |
1329 | XWindowAttributes wattr, wrootattr; |
866 | int sx, sy; |
1330 | int sx, sy; |
867 | Window cr; |
1331 | Window cr; |
868 | unsigned int rootpixmap_w = 0, rootpixmap_h = 0; |
1332 | unsigned int rootpixmap_w = 0, rootpixmap_h = 0; |
869 | |
1333 | |
870 | pchanged = 0; |
|
|
871 | |
|
|
872 | if (!option (Opt_transparent)) |
1334 | if (!option (Opt_transparent)) |
873 | return /*pchanged*/; /* Don't try any more */ |
1335 | return; /* Don't try any more */ |
874 | |
|
|
875 | #if 0 |
1336 | #if 0 |
876 | struct timeval stv; |
1337 | struct timeval stv; |
877 | gettimeofday (&stv,NULL); |
1338 | gettimeofday (&stv,NULL); |
878 | #define PRINT_BACKGROUND_OP_TIME do{ struct timeval tv;gettimeofday (&tv,NULL); tv.tv_sec-= stv.tv_sec;\ |
1339 | #define PRINT_BACKGROUND_OP_TIME do{ struct timeval tv;gettimeofday (&tv,NULL); tv.tv_sec-= stv.tv_sec;\ |
879 | fprintf (stderr,"%d: elapsed %ld usec\n",__LINE__,\ |
1340 | fprintf (stderr,"%d: elapsed %ld usec\n",__LINE__,\ |
… | |
… | |
890 | |
1351 | |
891 | if (rootdepth != wattr.depth) |
1352 | if (rootdepth != wattr.depth) |
892 | { |
1353 | { |
893 | if (am_transparent) |
1354 | if (am_transparent) |
894 | { |
1355 | { |
895 | pchanged = 1; |
|
|
896 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
1356 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
897 | am_transparent = am_pixmap_trans = 0; |
1357 | am_transparent = am_pixmap_trans = 0; |
898 | } |
1358 | } |
899 | |
1359 | |
900 | return /*pchanged*/; /* Don't try any more */ |
1360 | return; /* Don't try any more */ |
901 | } |
1361 | } |
902 | |
1362 | |
903 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
1363 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
904 | XSync (dpy, False); |
1364 | XSync (dpy, False); |
905 | |
1365 | |
… | |
… | |
963 | whole_tint = (IS_COMPONENT_WHOLESOME(c.r) |
1423 | whole_tint = (IS_COMPONENT_WHOLESOME(c.r) |
964 | && IS_COMPONENT_WHOLESOME(c.g) |
1424 | && IS_COMPONENT_WHOLESOME(c.g) |
965 | && IS_COMPONENT_WHOLESOME(c.b)); |
1425 | && IS_COMPONENT_WHOLESOME(c.b)); |
966 | no_tint = (c.r >= 0x00f700 && c.g >= 0x00f700 && c.b >= 0x00f700); |
1426 | no_tint = (c.r >= 0x00f700 && c.g >= 0x00f700 && c.b >= 0x00f700); |
967 | #undef IS_COMPONENT_WHOLESOME |
1427 | #undef IS_COMPONENT_WHOLESOME |
968 | /* theer are no performance advantages to reusing same pixmap */ |
|
|
969 | if (bgPixmap.pixmap != None) |
|
|
970 | XFreePixmap (dpy, bgPixmap.pixmap); |
|
|
971 | bgPixmap.pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, rootdepth); |
|
|
972 | bgPixmap.pmap_width = szHint.width; |
|
|
973 | bgPixmap.pmap_height = szHint.height; |
|
|
974 | bgPixmap.pmap_depth = rootdepth; |
|
|
975 | |
1428 | |
976 | #if 0 /* TODO : identify cases where this will be detrimental to performance : */ |
1429 | bgPixmap.make_transparency_pixmap(); |
977 | /* we want to tile root pixmap into our own pixmap in this cases : |
|
|
978 | * 1) rootpixmap does not cover our window entirely |
|
|
979 | * 2) whole_tint - we can use server-side tinting or tinting disabled |
|
|
980 | */ |
|
|
981 | if ( whole_tint || no_tint || pmap_w < sx + szHint.width || pmap_h < sy + szHint.height) |
|
|
982 | { |
|
|
983 | } |
|
|
984 | #endif |
|
|
985 | gcvalue.tile = rootpixmap; |
|
|
986 | gcvalue.fill_style = FillTiled; |
|
|
987 | gcvalue.ts_x_origin = -sx; |
|
|
988 | gcvalue.ts_y_origin = -sy; |
|
|
989 | gc = XCreateGC (dpy, rootpixmap, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcvalue); |
|
|
990 | XFillRectangle (dpy, bgPixmap.pixmap, gc, 0, 0, szHint.width, szHint.height); |
|
|
991 | |
1430 | |
992 | if (whole_tint && !no_tint) |
1431 | if (whole_tint && !no_tint) |
993 | { |
1432 | { |
994 | /* In this case we can tint image server-side getting significant |
|
|
995 | * performance improvements, as we eliminate XImage transfer |
|
|
996 | */ |
|
|
997 | gcvalue.foreground = Pixel (pix_colors_focused [Color_tint]); |
|
|
998 | gcvalue.function = GXand; |
|
|
999 | gcvalue.fill_style = FillSolid; |
|
|
1000 | XChangeGC (dpy, gc, GCFillStyle | GCForeground | GCFunction, &gcvalue); |
|
|
1001 | XFillRectangle (dpy, bgPixmap.pixmap, gc, 0, 0, szHint.width, szHint.height); |
|
|
1002 | } |
1433 | } |
1003 | success = True; |
1434 | success = True; |
1004 | #ifdef HAVE_AFTERIMAGE |
1435 | #ifdef HAVE_AFTERIMAGE |
1005 | if (rs[Rs_blurradius] || bgPixmap.original_asim != NULL || (!whole_tint && (!no_tint || shade !=100))) |
1436 | if (rs[Rs_blurradius] || bgPixmap.original_asim != NULL || (!whole_tint && (!no_tint || shade !=100))) |
1006 | { |
1437 | { |
… | |
… | |
1039 | back_im = tmp; |
1470 | back_im = tmp; |
1040 | } |
1471 | } |
1041 | } |
1472 | } |
1042 | /* TODO: temporary fix - redo the logic, so that same function can do both |
1473 | /* TODO: temporary fix - redo the logic, so that same function can do both |
1043 | transparency and non-transparency */ |
1474 | transparency and non-transparency */ |
1044 | bgPixmap.render_asim (this, back_im, tint); |
1475 | bgPixmap.render_asim (back_im, tint); |
1045 | destroy_asimage (&back_im); |
1476 | destroy_asimage (&back_im); |
1046 | |
1477 | |
1047 | } /* back_im != NULL */ |
1478 | } /* back_im != NULL */ |
1048 | else |
1479 | else |
1049 | success = False; |
1480 | success = False; |
… | |
… | |
1068 | #endif /* HAVE_AFTERIMAGE */ |
1499 | #endif /* HAVE_AFTERIMAGE */ |
1069 | PRINT_BACKGROUND_OP_TIME; |
1500 | PRINT_BACKGROUND_OP_TIME; |
1070 | |
1501 | |
1071 | if (gc != NULL) |
1502 | if (gc != NULL) |
1072 | XFreeGC (dpy, gc); |
1503 | XFreeGC (dpy, gc); |
1073 | |
1504 | |
|
|
1505 | bgPixmap.apply(); |
1074 | if (!success) |
1506 | if (!success) |
1075 | { |
|
|
1076 | if (am_transparent && am_pixmap_trans) |
|
|
1077 | { |
|
|
1078 | pchanged = 1; |
|
|
1079 | if (bgPixmap.pixmap != None) |
|
|
1080 | { |
|
|
1081 | XFreePixmap (dpy, bgPixmap.pixmap); |
|
|
1082 | bgPixmap.pixmap = None; |
|
|
1083 | } |
|
|
1084 | } |
|
|
1085 | |
|
|
1086 | am_pixmap_trans = 0; |
1507 | am_pixmap_trans = 0; |
1087 | } |
|
|
1088 | else |
1508 | else |
1089 | { |
1509 | { |
1090 | XSetWindowBackgroundPixmap (dpy, parent[0], bgPixmap.pixmap); |
|
|
1091 | XClearWindow (dpy, parent[0]); |
|
|
1092 | |
|
|
1093 | if (!am_transparent || !am_pixmap_trans) |
|
|
1094 | pchanged = 1; |
|
|
1095 | |
|
|
1096 | am_transparent = am_pixmap_trans = 1; |
1510 | am_transparent = am_pixmap_trans = 1; |
1097 | } |
1511 | } |
1098 | } /* rootpixmap != None */ |
1512 | } /* rootpixmap != None */ |
1099 | |
1513 | |
1100 | if (am_pixmap_trans) |
1514 | if (am_pixmap_trans) |
1101 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
1515 | { |
1102 | else |
|
|
1103 | return; |
|
|
1104 | |
|
|
1105 | if (scrollBar.win) |
1516 | if (scrollBar.win) |
1106 | { |
1517 | { |
1107 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
1108 | scrollBar.setIdle (); |
1518 | scrollBar.setIdle (); |
1109 | scrollbar_show (0); |
1519 | scrollbar_show (0); |
1110 | } |
1520 | } |
1111 | |
1521 | |
1112 | if (am_transparent) |
1522 | if (am_transparent) |
1113 | { |
1523 | { |
1114 | want_refresh = want_full_refresh = 1; |
1524 | want_refresh = want_full_refresh = 1; |
1115 | if (am_pixmap_trans) |
1525 | if (am_pixmap_trans) |
1116 | flush (); |
1526 | flush (); |
|
|
1527 | } |
1117 | } |
1528 | } |
1118 | |
1529 | #endif |
1119 | // return pchanged; |
|
|
1120 | } |
1530 | } |
1121 | #endif |
1531 | #endif |