ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.C
(Generate patch)

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.2 by sasha, Wed Sep 12 21:06:08 2007 UTC vs.
Revision 1.22 by sasha, Fri Jan 4 21:25:57 2008 UTC

1/*----------------------------------------------------------------------* 1/*----------------------------------------------------------------------*
2 * File: background.C - former xmp.C 2 * File: background.C - former xpm.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1997 Carsten Haitzler <raster@zip.com.au>
7 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de>
8 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
9 * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> 6 * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com>
10 * Copyright (c) 2007 Sasha Vasko <sasha@aftercode.net> 7 * Copyright (c) 2007 Sasha Vasko <sasha@aftercode.net>
11 * 8 *
12 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
28#include "rxvt.h" /* NECESSARY */ 25#include "rxvt.h" /* NECESSARY */
29 26
30#define DO_TIMING_TEST 0 27#define DO_TIMING_TEST 0
31 28
32#if DO_TIMING_TEST 29#if DO_TIMING_TEST
30# include <sys/time.h>
33#define TIMING_TEST_START(id) \ 31#define TIMING_TEST_START(id) \
34 struct timeval timing_test_##id##_stv;\ 32 struct timeval timing_test_##id##_stv;\
35 gettimeofday (&timing_test_##id##_stv, NULL); 33 gettimeofday (&timing_test_##id##_stv, NULL);
36 34
37#define TIMING_TEST_PRINT_RESULT(id) \ 35#define TIMING_TEST_PRINT_RESULT(id) \
38 do{ struct timeval tv;gettimeofday (&tv, NULL); tv.tv_sec -= (timing_test_##id##_stv).tv_sec;\ 36 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__,\ 37 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) 38 tv.tv_sec * 1000000 + tv.tv_usec - (timing_test_##id##_stv).tv_usec);}while (0)
41 39
87 * scale Scale both up and down 85 * scale Scale both up and down
88 * auto Same as 100x100+50+50 86 * auto Same as 100x100+50+50
89 */ 87 */
90 88
91#ifdef HAVE_BG_PIXMAP 89#ifdef HAVE_BG_PIXMAP
92bgPixmap_t::bgPixmap_t() 90bgPixmap_t::bgPixmap_t ()
93{ 91{
94#ifdef HAVE_AFTERIMAGE 92#ifdef HAVE_AFTERIMAGE
95 original_asim = NULL; 93 original_asim = NULL;
96#endif 94#endif
97#ifdef BG_IMAGE_FROM_FILE 95#ifdef BG_IMAGE_FROM_FILE
98 h_scale = v_scale = 0; 96 h_scale = v_scale = 0;
99 h_align = v_align = 0; 97 h_align = v_align = 0;
100#endif 98#endif
101 flags = 0; 99 flags = 0;
102 pixmap = None; 100 pixmap = None;
101 valid_since = invalid_since = 0;
103} 102}
104 103
104void
105bgPixmap_t::destroy ()
106{
107#ifdef HAVE_AFTERIMAGE
108 if (original_asim)
109 safe_asimage_destroy (original_asim);
110#endif
111
112 if (pixmap && target)
113 XFreePixmap (target->dpy, pixmap);
114}
105 115
106bool 116bool
107bgPixmap_t::window_size_sensitive () 117bgPixmap_t::window_size_sensitive ()
108{ 118{
119# ifdef ENABLE_TRANSPARENCY
120 if (flags & isTransparent)
121 return true;
122# endif
123
109# ifdef BG_IMAGE_FROM_FILE 124# ifdef BG_IMAGE_FROM_FILE
110# ifdef HAVE_AFTERIMAGE 125# ifdef HAVE_AFTERIMAGE
111 if (original_asim != NULL) 126 if (original_asim != NULL)
112# endif 127# endif
113 { 128 {
114 if (h_scale != 0 || v_scale != 0 129 if (h_scale != 0 || v_scale != 0
115 || h_align != 0 || v_align != 0) 130 || h_align != 0 || v_align != 0)
116 return true; 131 return true;
117 } 132 }
118# endif 133# endif
134
135 return false;
136}
137
138bool
139bgPixmap_t::window_position_sensitive ()
140{
119# ifdef ENABLE_TRANSPARENCY 141# ifdef ENABLE_TRANSPARENCY
120 if (flags & isTransparent) 142 if (flags & isTransparent)
121 return true; 143 return true;
122# endif 144# endif
145
146# ifdef BG_IMAGE_FROM_FILE
147# ifdef HAVE_AFTERIMAGE
148 if (original_asim != NULL)
149# endif
150 {
151 if (h_align == rootAlign || v_align == rootAlign)
152 return true;
153 }
154# endif
155
123 return false; 156 return false;
124} 157};
125 158
126bool bgPixmap_t::need_client_side_rendering () 159bool bgPixmap_t::need_client_side_rendering ()
127{ 160{
128# ifdef HAVE_AFTERIMAGE 161# ifdef HAVE_AFTERIMAGE
129 if (original_asim != NULL) 162 if (original_asim != NULL)
130 return true; 163 return true;
131# endif 164# endif
132# ifdef ENABLE_TRANSPARENCY 165# ifdef ENABLE_TRANSPARENCY
133 if (flags & isTransparent) 166 if (flags & isTransparent)
134 { 167 {
168# ifdef HAVE_AFTERIMAGE // can't blur without libAI anyways
135 if (((flags & blurNeeded) && !(flags & blurServerSide)) 169 if ((flags & blurNeeded) && !(flags & blurServerSide))
170 return true;
171# endif
136 || ((flags & tintNeeded) && !(flags & tintServerSide))) 172 if ((flags & tintNeeded) && !(flags & tintServerSide))
137 return true; 173 return true;
138 } 174 }
139# endif 175# endif
140 return false; 176 return false;
141} 177}
142 178
160static inline bool 196static inline bool
161check_set_align_value (int geom_flags, int flag, int &align, int new_value) 197check_set_align_value (int geom_flags, int flag, int &align, int new_value)
162{ 198{
163 if (geom_flags & flag) 199 if (geom_flags & flag)
164 { 200 {
201 if (new_value != bgPixmap_t::rootAlign)
202 {
165 if (new_value < -100) 203 if (new_value < -100)
166 new_value = -100; 204 new_value = -100;
167 else if (new_value > 200) 205 else if (new_value > 200)
168 new_value = 200; 206 new_value = 200;
207 }
169 if (new_value != align) 208 if (new_value != align)
170 { 209 {
171 align = new_value; 210 align = new_value;
172 return true; 211 return true;
173 } 212 }
265 y = x; 304 y = x;
266 geom_flags |= YValue; 305 geom_flags |= YValue;
267 } 306 }
268 307
269 if (flags & geometrySet) 308 if (flags & geometrySet)
309 {
270 {/* new geometry is an adjustment to the old one ! */ 310 /* new geometry is an adjustment to the old one ! */
271 if ((geom_flags & WidthValue) && (geom_flags & HeightValue)) 311 if ((geom_flags & WidthValue) && (geom_flags & HeightValue))
272 { 312 {
273 if (w == 0 && h != 0) 313 if (w == 0 && h != 0)
274 { 314 {
275 w = h_scale; 315 w = h_scale;
291 } 331 }
292 } 332 }
293 else /* setting up geometry from scratch */ 333 else /* setting up geometry from scratch */
294 { 334 {
295 if (!(geom_flags & XValue)) 335 if (!(geom_flags & XValue))
336 {
296 {/* use default geometry - centered */ 337 /* use default geometry - centered */
297 x = y = defaultAlign; 338 x = y = defaultAlign;
298 } 339 }
299 else if (!(geom_flags & YValue)) 340 else if (!(geom_flags & YValue))
300 y = x; 341 y = x;
301 342
302 if ((geom_flags & (WidthValue|HeightValue)) == 0) 343 if ((geom_flags & (WidthValue|HeightValue)) == 0)
344 {
303 {/* use default geometry - scaled */ 345 /* use default geometry - scaled */
304 w = h = defaultScale; 346 w = h = defaultScale;
305 } 347 }
306 else if (geom_flags & WidthValue) 348 else if (geom_flags & WidthValue)
307 { 349 {
308 if (!(geom_flags & HeightValue)) 350 if (!(geom_flags & HeightValue))
311 else 353 else
312 w = h; 354 w = h;
313 } 355 }
314 } /* done parsing geometry string */ 356 } /* done parsing geometry string */
315 else if (!(flags & geometrySet)) 357 else if (!(flags & geometrySet))
358 {
316 { /* default geometry - scaled and centered */ 359 /* default geometry - scaled and centered */
317 x = y = defaultAlign; 360 x = y = defaultAlign;
318 w = h = defaultScale; 361 w = h = defaultScale;
319 } 362 }
320 363
321 if (!(flags & geometrySet)) 364 if (!(flags & geometrySet))
322 geom_flags |= WidthValue|HeightValue|XValue|YValue; 365 geom_flags |= WidthValue|HeightValue|XValue|YValue;
323 366
324 if (ops) 367 if (ops)
325 { 368 {
327 { 370 {
328 while (*ops == ':' || isspace(*ops)) ++ops; 371 while (*ops == ':' || isspace(*ops)) ++ops;
329# define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) 372# define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0)
330 if (CHECK_GEOM_OPS("tile")) 373 if (CHECK_GEOM_OPS("tile"))
331 { 374 {
332 w = h = 0; 375 w = h = noScale;
333 geom_flags |= WidthValue|HeightValue; 376 geom_flags |= WidthValue|HeightValue;
334 } 377 }
335 else if (CHECK_GEOM_OPS("propscale")) 378 else if (CHECK_GEOM_OPS("propscale"))
336 { 379 {
337 if (w == 0 && h == 0) 380 if (w == 0 && h == 0)
338 { 381 {
339 w = 100; 382 w = windowScale;
340 geom_flags |= WidthValue; 383 geom_flags |= WidthValue;
341 } 384 }
342 new_flags |= propScale; 385 new_flags |= propScale;
343 } 386 }
344 else if (CHECK_GEOM_OPS("hscale")) 387 else if (CHECK_GEOM_OPS("hscale"))
345 { 388 {
346 if (w == 0) 389 if (w == 0)
347 w = 100; 390 w = windowScale;
348 h = 0; 391 h = noScale;
349 geom_flags |= WidthValue|HeightValue; 392 geom_flags |= WidthValue|HeightValue;
350 } 393 }
351 else if (CHECK_GEOM_OPS("vscale")) 394 else if (CHECK_GEOM_OPS("vscale"))
352 { 395 {
353 if (h == 0) 396 if (h == 0)
354 h = 100; 397 h = windowScale;
355 w = 0; 398 w = noScale;
356 geom_flags |= WidthValue|HeightValue; 399 geom_flags |= WidthValue|HeightValue;
357 } 400 }
358 else if (CHECK_GEOM_OPS("scale")) 401 else if (CHECK_GEOM_OPS("scale"))
359 { 402 {
360 if (h == 0) 403 if (h == 0)
361 h = 100; 404 h = windowScale;
362 if (w == 0) 405 if (w == 0)
363 w = 100; 406 w = windowScale;
364 geom_flags |= WidthValue|HeightValue; 407 geom_flags |= WidthValue|HeightValue;
365 } 408 }
366 else if (CHECK_GEOM_OPS("auto")) 409 else if (CHECK_GEOM_OPS("auto"))
367 { 410 {
411 w = h = windowScale;
412 x = y = centerAlign;
413 geom_flags |= WidthValue|HeightValue|XValue|YValue;
414 }
415 else if (CHECK_GEOM_OPS("root"))
416 {
368 w = h = 100; 417 w = h = noScale;
369 x = y = 50; 418 x = y = rootAlign;
370 geom_flags |= WidthValue|HeightValue|XValue|YValue; 419 geom_flags |= WidthValue|HeightValue|XValue|YValue;
371 } 420 }
372# undef CHECK_GEOM_OPS 421# undef CHECK_GEOM_OPS
373 while (*ops != ':' && *ops != '\0') ++ops; 422 while (*ops != ':' && *ops != '\0') ++ops;
374 } /* done parsing ops */ 423 } /* done parsing ops */
387 if (new_flags != flags) 436 if (new_flags != flags)
388 { 437 {
389 flags = new_flags; 438 flags = new_flags;
390 changed++; 439 changed++;
391 } 440 }
392//fprintf( stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", 441//fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n",
393// flags, h_scale, v_scale, h_align, v_align); 442// flags, h_scale, v_scale, h_align, v_align);
394 return (changed > 0); 443 return (changed > 0);
395} 444}
396 445
397# ifdef HAVE_AFTERIMAGE 446# ifdef HAVE_AFTERIMAGE
413 462
414 TIMING_TEST_START (asim); 463 TIMING_TEST_START (asim);
415 464
416 if (original_asim) 465 if (original_asim)
417 { 466 {
467 if (h_align == rootAlign || v_align == rootAlign)
468 {
469 target->get_window_origin(x, y);
470 x = -x;
471 y = -y;
472 }
473 if (h_align != rootAlign)
418 x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); 474 x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width);
475 if (v_align != rootAlign)
419 y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); 476 y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height);
420 } 477 }
421 478
422 if (original_asim == NULL 479 if (original_asim == NULL
423 || x >= target_width 480 || x >= target_width
424 || y >= target_height 481 || y >= target_height
446 { 503 {
447 result = original_asim; 504 result = original_asim;
448 if ((w > 0 && w != original_asim->width) 505 if ((w > 0 && w != original_asim->width)
449 || (h > 0 && h != original_asim->height)) 506 || (h > 0 && h != original_asim->height))
450 { 507 {
451 result = scale_asimage (target->asv, original_asim, 508 result = scale_asimage (target->asv, original_asim,
452 w > 0 ? w : original_asim->width, 509 w > 0 ? w : original_asim->width,
453 h > 0 ? h : original_asim->height, 510 h > 0 ? h : original_asim->height,
454 background ? ASA_ASImage : ASA_XImage, 511 background ? ASA_ASImage : ASA_XImage,
455 100, ASIMAGE_QUALITY_DEFAULT); 512 100, ASIMAGE_QUALITY_DEFAULT);
456 } 513 }
457 if (background == NULL) 514 if (background == NULL)
515 {
458 {/* if tiling - pixmap has to be sized exactly as the image */ 516 /* if tiling - pixmap has to be sized exactly as the image,
517 but there is no need to make it bigger then the window! */
459 if (h_scale == 0) 518 if (h_scale == 0)
460 new_pmap_width = result->width; 519 new_pmap_width = min (result->width, target_width);
461 if (v_scale == 0) 520 if (v_scale == 0)
462 new_pmap_height = result->height; 521 new_pmap_height = min (result->height, target_height);
463 /* we also need to tile our image in one or both directions */ 522 /* we also need to tile our image in one or both directions */
464 if (h_scale == 0 || v_scale == 0) 523 if (h_scale == 0 || v_scale == 0)
465 { 524 {
466 ASImage *tmp = tile_asimage (target->asv, result, 525 ASImage *tmp = tile_asimage (target->asv, result,
467 (h_scale > 0) ? 0 : (int)result->width - x, 526 (h_scale > 0) ? 0 : (int)result->width - x,
468 (v_scale > 0) ? 0 : (int)result->height - y, 527 (v_scale > 0) ? 0 : (int)result->height - y,
528 new_pmap_width,
469 result->width, result->height, 529 new_pmap_height,
470 TINT_LEAVE_SAME, ASA_XImage, 530 TINT_LEAVE_SAME, ASA_XImage,
471 100, ASIMAGE_QUALITY_DEFAULT); 531 100, ASIMAGE_QUALITY_DEFAULT);
472 if (tmp) 532 if (tmp)
473 { 533 {
474 if (result != original_asim) 534 if (result != original_asim)
476 result = tmp; 536 result = tmp;
477 } 537 }
478 } 538 }
479 } 539 }
480 else 540 else
541 {
481 {/* if blending background and image - pixmap has to be sized same as target window */ 542 /* if blending background and image - pixmap has to be sized same as target window */
482 ASImageLayer *layers = create_image_layers (2); 543 ASImageLayer *layers = create_image_layers (2);
483 ASImage *merged_im = NULL; 544 ASImage *merged_im = NULL;
484 545
485 layers[0].im = background; 546 layers[0].im = background;
486 layers[0].clip_width = target_width; 547 layers[0].clip_width = target_width;
487 layers[0].clip_height = target_height; 548 layers[0].clip_height = target_height;
488 layers[0].tint = background_tint; 549 layers[0].tint = background_tint;
489 layers[1].im = result; 550 layers[1].im = result;
490 if (w <= 0) 551 if (w <= 0)
552 {
491 {/* tile horizontally */ 553 /* tile horizontally */
492 while (x > 0) x -= (int)result->width; 554 while (x > 0) x -= (int)result->width;
493 layers[1].dst_x = x; 555 layers[1].dst_x = x;
494 layers[1].clip_width = result->width+target_width; 556 layers[1].clip_width = result->width+target_width;
495 } 557 }
496 else 558 else
559 {
497 {/* clip horizontally */ 560 /* clip horizontally */
498 layers[1].dst_x = x; 561 layers[1].dst_x = x;
499 layers[1].clip_width = result->width; 562 layers[1].clip_width = result->width;
500 } 563 }
501 if (h <= 0) 564 if (h <= 0)
502 { 565 {
575 } 638 }
576 639
577 /* put result on pixmap */ 640 /* put result on pixmap */
578 if (dst_x < new_pmap_width && dst_y < new_pmap_height) 641 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); 642 asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True);
580 643
581 if (result != background && result != original_asim) 644 if (result != background && result != original_asim)
582 destroy_asimage (&result); 645 destroy_asimage (&result);
583 646
584 XFreeGC (target->dpy, gc); 647 XFreeGC (target->dpy, gc);
585 TIMING_TEST_PRINT_RESULT (asim); 648 TIMING_TEST_PRINT_RESULT (asim);
611 f[len] = '\0'; 674 f[len] = '\0';
612 original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); 675 original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100);
613 free (f); 676 free (f);
614 } 677 }
615 return (original_asim != NULL); 678 return (original_asim != NULL);
616# endif 679# endif
617 } 680 }
618 return false; 681 return false;
619} 682}
620 683
621# endif /* BG_IMAGE_FROM_FILE */ 684# endif /* BG_IMAGE_FROM_FILE */
622 685
623# ifdef ENABLE_TRANSPARENCY 686# ifdef ENABLE_TRANSPARENCY
624bool 687bool
625bgPixmap_t::set_transparent () 688bgPixmap_t::set_transparent ()
626{ 689{
627 if (!(flags & isTransparent)) 690 if (!(flags & isTransparent))
628 { 691 {
629 flags |= isTransparent; 692 flags |= isTransparent;
654 if (v_blurRadius != vr) 717 if (v_blurRadius != vr)
655 { 718 {
656 ++changed; 719 ++changed;
657 v_blurRadius = vr; 720 v_blurRadius = vr;
658 } 721 }
659 722
660 if (v_blurRadius == 0 && h_blurRadius == 0) 723 if (v_blurRadius == 0 && h_blurRadius == 0)
661 flags &= ~blurNeeded; 724 flags &= ~blurNeeded;
662 else 725 else
663 flags |= blurNeeded; 726 flags |= blurNeeded;
664 727
668static inline unsigned long 731static inline unsigned long
669compute_tint_shade_flags (rxvt_color *tint, int shade) 732compute_tint_shade_flags (rxvt_color *tint, int shade)
670{ 733{
671 unsigned long flags = 0; 734 unsigned long flags = 0;
672 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); 735 rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC);
736 bool has_shade = (shade > 0 && shade < 100) || (shade > 100 && shade < 200);
673 737
674 if (tint) 738 if (tint)
675 { 739 {
676 tint->get (c); 740 tint->get (c);
677# define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700) 741# define IS_COMPONENT_WHOLESOME(cmp) ((cmp) <= 0x000700 || (cmp) >= 0x00f700)
678 if (IS_COMPONENT_WHOLESOME (c.r) 742 if (!has_shade && IS_COMPONENT_WHOLESOME (c.r)
679 && IS_COMPONENT_WHOLESOME (c.g) 743 && IS_COMPONENT_WHOLESOME (c.g)
680 && IS_COMPONENT_WHOLESOME (c.b)) 744 && IS_COMPONENT_WHOLESOME (c.b))
681 flags |= bgPixmap_t::tintWholesome; 745 flags |= bgPixmap_t::tintWholesome;
682# undef IS_COMPONENT_WHOLESOME 746# undef IS_COMPONENT_WHOLESOME
683 } 747 }
684 748
685 if ((shade > 0 && shade < 100) || (shade > 100 && shade < 200)) 749 if (has_shade)
686 flags |= bgPixmap_t::tintNeeded; 750 flags |= bgPixmap_t::tintNeeded;
687 else if (tint) 751 else if (tint)
688 { 752 {
689 if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700) 753 if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700)
690 && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) 754 && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700))
691 { 755 {
692 flags |= bgPixmap_t::tintNeeded; 756 flags |= bgPixmap_t::tintNeeded;
693 } 757 }
694 } 758 }
695 759
696 if (flags & bgPixmap_t::tintNeeded) 760 if (flags & bgPixmap_t::tintNeeded)
697 { 761 {
698 if (flags & bgPixmap_t::tintWholesome) 762 if (flags & bgPixmap_t::tintWholesome)
699 flags |= bgPixmap_t::tintServerSide; 763 flags |= bgPixmap_t::tintServerSide;
764 else
765 {
700#if XFT 766#if XFT
701 flags |= bgPixmap_t::tintServerSide; 767 flags |= bgPixmap_t::tintServerSide;
702#endif 768#endif
769 }
703 } 770 }
704 771
705 return flags; 772 return flags;
706} 773}
707 774
713 unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); 780 unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade);
714 tint = new_tint; 781 tint = new_tint;
715 flags = (flags & ~tintFlags) | new_flags | tintSet; 782 flags = (flags & ~tintFlags) | new_flags | tintSet;
716 return true; 783 return true;
717 } 784 }
785
718 return false; 786 return false;
719} 787}
720 788
721bool 789bool
722bgPixmap_t::unset_tint () 790bgPixmap_t::unset_tint ()
726 if (new_flags != (flags & tintFlags)) 794 if (new_flags != (flags & tintFlags))
727 { 795 {
728 flags = (flags&~tintFlags)|new_flags; 796 flags = (flags&~tintFlags)|new_flags;
729 return true; 797 return true;
730 } 798 }
799
731 return false; 800 return false;
732} 801}
733 802
734bool 803bool
735bgPixmap_t::set_shade (const char *shade_str) 804bgPixmap_t::set_shade (const char *shade_str)
736{ 805{
737 int new_shade = (shade_str) ? atoi (shade_str) : 0; 806 int new_shade = (shade_str) ? atoi (shade_str) : 0;
738 807
808 if (new_shade < 0 && new_shade > -100)
809 new_shade = 200 - (100 + new_shade);
739 if (new_shade == 100) 810 else if (new_shade == 100)
740 new_shade = 0; 811 new_shade = 0;
741 812
742 if (new_shade != shade) 813 if (new_shade != shade)
743 { 814 {
744 unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); 815 unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade);
745 shade = new_shade; 816 shade = new_shade;
746 flags = (flags & ~tintFlags) | new_flags; 817 flags = (flags & (~tintFlags | tintSet)) | new_flags;
747 return true; 818 return true;
748 } 819 }
820
749 return false; 821 return false;
750} 822}
751 823
752/* make_transparency_pixmap() 824/* make_transparency_pixmap()
753 * Builds a pixmap sized the same as terminal window, with depth same as the root window 825 * Builds a pixmap sized the same as terminal window, with depth same as the root window
754 * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by 826 * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by
755 * our window. 827 * our window.
756 */ 828 */
757unsigned long 829unsigned long
758bgPixmap_t::make_transparency_pixmap () 830bgPixmap_t::make_transparency_pixmap ()
759{ 831{
783 if (sx + window_width <= 0 || sy + window_height <= 0 855 if (sx + window_width <= 0 || sy + window_height <= 0
784 || sx >= root_width || sy >= root_height) 856 || sx >= root_width || sy >= root_height)
785 return 0; 857 return 0;
786 858
787 if (root_pixmap != None) 859 if (root_pixmap != None)
860 {
788 {/* we want to validate the pixmap and get it's size at the same time : */ 861 /* we want to validate the pixmap and get it's size at the same time : */
789 int junk; 862 int junk;
790 unsigned int ujunk; 863 unsigned int ujunk;
791 /* root pixmap may be bad - allow a error */ 864 /* root pixmap may be bad - allow a error */
792 target->allowedxerror = -1; 865 target->allowedxerror = -1;
793 866
802 875
803 if (tiled_root_pmap == None) /* something really bad happened - abort */ 876 if (tiled_root_pmap == None) /* something really bad happened - abort */
804 return 0; 877 return 0;
805 878
806 if (root_pixmap == None) 879 if (root_pixmap == None)
880 {
807 { /* use tricks to obtain the root background image :*/ 881 /* use tricks to obtain the root background image :*/
808 /* we want to create Overrideredirect window overlapping out window 882 /* we want to create Overrideredirect window overlapping out window
809 with background type of Parent Relative and then grab it */ 883 with background type of Parent Relative and then grab it */
810 XSetWindowAttributes attr; 884 XSetWindowAttributes attr;
811 Window src; 885 Window src;
812 bool success = false; 886 bool success = false;
827 XGrabServer (dpy); 901 XGrabServer (dpy);
828 XMapRaised (dpy, src); 902 XMapRaised (dpy, src);
829 XSync (dpy, False); 903 XSync (dpy, False);
830 904
831 /* XSync should get window where it's properly exposed, 905 /* XSync should get window where it's properly exposed,
832 * but to be on the safe side - let's check for the actuall event to arrive : */ 906 * but to be on the safe side - let's check for the actual event to arrive : */
833 while (XCheckWindowEvent (dpy, src, ExposureMask, &event)) 907 while (XCheckWindowEvent (dpy, src, ExposureMask, &event))
834 ++ev_count; 908 ++ev_count;
835 909
836 if (ev_count > 0); 910 if (ev_count > 0);
911 {
837 { /* hooray! - we can grab the image! */ 912 /* hooray! - we can grab the image! */
838 gc = XCreateGC (dpy, root, 0, NULL); 913 gc = XCreateGC (dpy, root, 0, NULL);
839 if (gc) 914 if (gc)
840 { 915 {
841 XCopyArea (dpy, src, tiled_root_pmap, gc, 0, 0, window_width, window_height, 0, 0); 916 XCopyArea (dpy, src, tiled_root_pmap, gc, 0, 0, window_width, window_height, 0, 0);
842 success = true; 917 success = true;
843 } 918 }
844 } 919 }
920
845 XDestroyWindow (dpy, src); 921 XDestroyWindow (dpy, src);
846 XUngrabServer (dpy); 922 XUngrabServer (dpy);
847 //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count); 923 //fprintf (stderr, "%s:%d: ev_count = %d\n", __FUNCTION__, __LINE__, ev_count);
848 } 924 }
849 925
854 } 930 }
855 else 931 else
856 result |= transpPmapTiled; 932 result |= transpPmapTiled;
857 } 933 }
858 else 934 else
935 {
859 {/* strightforward pixmap copy */ 936 /* strightforward pixmap copy */
860 gcv.tile = root_pixmap; 937 gcv.tile = root_pixmap;
861 gcv.fill_style = FillTiled; 938 gcv.fill_style = FillTiled;
862 939
863 while (sx < 0) sx += (int)window_width; 940 while (sx < 0) sx += (int)root_width;
864 while (sy < 0) sy += (int)window_height; 941 while (sy < 0) sy += (int)root_height;
865 942
866 gcv.ts_x_origin = -sx; 943 gcv.ts_x_origin = -sx;
867 gcv.ts_y_origin = -sy; 944 gcv.ts_y_origin = -sy;
868 gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); 945 gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
869 946
875 } 952 }
876 TIMING_TEST_PRINT_RESULT (tp); 953 TIMING_TEST_PRINT_RESULT (tp);
877 954
878 if (tiled_root_pmap != None) 955 if (tiled_root_pmap != None)
879 { 956 {
880 if (!need_client_side_rendering ()) 957 if (!need_client_side_rendering ())
881 { 958 {
882 if ((flags & tintNeeded)) 959 if ((flags & tintNeeded))
883 { 960 {
884 if (flags & tintWholesome) 961 if (flags & tintWholesome)
885 { 962 {
886 /* In this case we can tint image server-side getting significant 963 /* In this case we can tint image server-side getting significant
887 * performance improvements, as we eliminate XImage transfer 964 * performance improvements, as we eliminate XImage transfer
912 { 989 {
913 c.r = (c.r * shade) / 100; 990 c.r = (c.r * shade) / 100;
914 c.g = (c.g * shade) / 100; 991 c.g = (c.g * shade) / 100;
915 c.b = (c.b * shade) / 100; 992 c.b = (c.b * shade) / 100;
916 } 993 }
917 else if( shade > 100 && shade < 200) 994 else if (shade > 100 && shade < 200)
918 { 995 {
919 c.r = (c.r * (200 - shade)) / 100; 996 c.r = (c.r * (200 - shade)) / 100;
920 c.g = (c.g * (200 - shade)) / 100; 997 c.g = (c.g * (200 - shade)) / 100;
921 c.b = (c.b * (200 - shade)) / 100; 998 c.b = (c.b * (200 - shade)) / 100;
922 } 999 }
928 pf.direct.greenMask = 0xff; 1005 pf.direct.greenMask = 0xff;
929 pf.direct.blueMask = 0xff; 1006 pf.direct.blueMask = 0xff;
930 pf.direct.alphaMask = 0xff; 1007 pf.direct.alphaMask = 0xff;
931 1008
932 XRenderPictFormat *solid_format = XRenderFindFormat (dpy, 1009 XRenderPictFormat *solid_format = XRenderFindFormat (dpy,
933 (PictFormatType| 1010 (PictFormatType|
934 PictFormatDepth| 1011 PictFormatDepth|
935 PictFormatRedMask| 1012 PictFormatRedMask|
936 PictFormatGreenMask| 1013 PictFormatGreenMask|
937 PictFormatBlueMask| 1014 PictFormatBlueMask|
938 PictFormatAlphaMask), 1015 PictFormatAlphaMask),
939 &pf, 1016 &pf,
940 0); 1017 0);
941 XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen))); 1018 XRenderPictFormat *root_format = XRenderFindVisualFormat (dpy, DefaultVisualOfScreen (ScreenOfDisplay (dpy, target->display->screen)));
942 XRenderPictureAttributes pa ; 1019 XRenderPictureAttributes pa ;
943 1020
944 back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa); 1021 back_pic = XRenderCreatePicture (dpy, tiled_root_pmap, root_format, 0, &pa);
945 1022
947 1024
948 Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32); 1025 Pixmap overlay_pmap = XCreatePixmap (dpy, root, 1, 1, 32);
949 Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa); 1026 Picture overlay_pic = XRenderCreatePicture (dpy, overlay_pmap, solid_format, CPRepeat, &pa);
950 XFreePixmap (dpy, overlay_pmap); 1027 XFreePixmap (dpy, overlay_pmap);
951 1028
952 pa.component_alpha = True; 1029 pa.component_alpha = True;
953 Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32); 1030 Pixmap mask_pmap = XCreatePixmap (dpy, root, 1, 1, 32);
954 Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa); 1031 Picture mask_pic = XRenderCreatePicture (dpy, mask_pmap, solid_format, CPRepeat|CPComponentAlpha, &pa);
955 XFreePixmap (dpy, mask_pmap); 1032 XFreePixmap (dpy, mask_pmap);
956 1033
957 if (mask_pic && overlay_pic && back_pic) 1034 if (mask_pic && overlay_pic && back_pic)
959 XRenderColor mask_c; 1036 XRenderColor mask_c;
960 1037
961 memset (&mask_c, (shade > 100) ? 0xFF : 0x0, sizeof (mask_c)); 1038 memset (&mask_c, (shade > 100) ? 0xFF : 0x0, sizeof (mask_c));
962 mask_c.alpha = 0xffff; 1039 mask_c.alpha = 0xffff;
963 XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1); 1040 XRenderFillRectangle (dpy, PictOpSrc, overlay_pic, &mask_c, 0, 0, 1, 1);
964 memset (&mask_c, 0x0, sizeof (mask_c)); 1041
965 mask_c.alpha = 0; 1042 mask_c.alpha = 0;
966 1043 mask_c.red = 0xffff - c.r;
967 if (c.r == c.b && c.b == c.g) /* pure shading */ 1044 mask_c.green = 0xffff - c.g;
968 { 1045 mask_c.blue = 0xffff - c.b;
969 mask_c.red = mask_c.green = mask_c.blue = 0xffff - c.r;
970 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1); 1046 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1);
971 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height); 1047 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height);
972 }
973 else
974 {
975 mask_c.red = 0xffff - c.r;
976 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1);
977 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height);
978 mask_c.red = 0;
979 mask_c.green = 0xffff - c.g;
980 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1);
981 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height);
982 mask_c.green = 0;
983 mask_c.blue = 0xffff - c.b;
984 XRenderFillRectangle (dpy, PictOpSrc, mask_pic, &mask_c, 0, 0, 1, 1);
985 XRenderComposite (dpy, PictOpOver, overlay_pic, mask_pic, back_pic, 0, 0, 0, 0, 0, 0, window_width, window_height);
986 }
987 result |= transpPmapTinted; 1048 result |= transpPmapTinted;
988 } 1049 }
1050
989 XRenderFreePicture (dpy, mask_pic); 1051 XRenderFreePicture (dpy, mask_pic);
990 XRenderFreePicture (dpy, overlay_pic); 1052 XRenderFreePicture (dpy, overlay_pic);
991 XRenderFreePicture (dpy, back_pic); 1053 XRenderFreePicture (dpy, back_pic);
992# if DO_TIMING_TEST 1054# if DO_TIMING_TEST
993 XSync (dpy, False); 1055 XSync (dpy, False);
994# endif 1056# endif
995# endif 1057# endif
996 } 1058 }
997 } 1059 }
998 } /* server side rendering completed */ 1060 } /* server side rendering completed */
999 1061
1003 pixmap = tiled_root_pmap; 1065 pixmap = tiled_root_pmap;
1004 pmap_width = window_width; 1066 pmap_width = window_width;
1005 pmap_height = window_height; 1067 pmap_height = window_height;
1006 pmap_depth = root_depth; 1068 pmap_depth = root_depth;
1007 } 1069 }
1008 1070
1009 if (gc) 1071 if (gc)
1010 XFreeGC (dpy, gc); 1072 XFreeGC (dpy, gc);
1011 1073
1012 TIMING_TEST_PRINT_RESULT (tp); 1074 TIMING_TEST_PRINT_RESULT (tp);
1013 1075
1014 return result; 1076 return result;
1015} 1077}
1016 1078
1017bool 1079bool
1018bgPixmap_t::set_root_pixmap () 1080bgPixmap_t::set_root_pixmap ()
1019{ 1081{
1020 Pixmap new_root_pixmap = None;
1021
1022 new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); 1082 Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID);
1023 if (new_root_pixmap == None) 1083 if (new_root_pixmap == None)
1024 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); 1084 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID);
1025 1085
1026 if (new_root_pixmap != root_pixmap) 1086 if (new_root_pixmap != root_pixmap)
1027 { 1087 {
1028 root_pixmap = new_root_pixmap; 1088 root_pixmap = new_root_pixmap;
1029 return true; 1089 return true;
1030 } 1090 }
1091
1031 return false; 1092 return false;
1032} 1093}
1033# endif /* ENABLE_TRANSPARENCY */ 1094# endif /* ENABLE_TRANSPARENCY */
1034 1095
1035# ifndef HAVE_AFTERIMAGE 1096# ifndef HAVE_AFTERIMAGE
1036static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm); 1097static void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm);
1037# endif 1098# endif
1038 1099
1039
1040bool 1100bool
1041bgPixmap_t::render () 1101bgPixmap_t::render ()
1042{ 1102{
1043 unsigned long background_flags = 0; 1103 unsigned long background_flags = 0;
1044 1104
1045 if (target == NULL) 1105 if (target == NULL)
1046 return false; 1106 return false;
1107
1108 TIMING_TEST_START (tp);
1047 1109
1048 invalidate(); 1110 invalidate();
1049# ifdef ENABLE_TRANSPARENCY 1111# ifdef ENABLE_TRANSPARENCY
1050 if (flags & isTransparent) 1112 if (flags & isTransparent)
1051 { 1113 {
1104 } 1166 }
1105 else if (background_flags && pmap_depth != target->depth) 1167 else if (background_flags && pmap_depth != target->depth)
1106 { 1168 {
1107 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); 1169 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap);
1108 } 1170 }
1171
1109# else /* our own client-side tinting */ 1172# elif !XFT /* our own client-side tinting */
1173
1174 /* ATTENTION: We ASSUME that XFT will let us do all the tinting neccessary server-side.
1175 This may need to be changed in need_client_side_rendering() logic is altered !!! */
1176
1110 if (background_flags && (flags & isInvalid)) 1177 if (background_flags && (flags & isInvalid))
1111 { 1178 {
1112 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); 1179 result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap);
1113 if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) 1180 if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded))
1114 { 1181 {
1118 ShadeXImage (target, result, shade, c.r, c.g, c.b); 1185 ShadeXImage (target, result, shade, c.r, c.g, c.b);
1119 } 1186 }
1120 } 1187 }
1121# endif /* HAVE_AFTERIMAGE */ 1188# endif /* HAVE_AFTERIMAGE */
1122 1189
1123 if (result != NULL) 1190 if (result)
1124 { 1191 {
1125 GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); 1192 GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL);
1193
1126 if (gc) 1194 if (gc)
1127 { 1195 {
1128 if (/*pmap_depth != target->depth &&*/ pixmap != None) 1196 if (/*pmap_depth != target->depth &&*/ pixmap != None)
1129 { 1197 {
1130 XFreePixmap (target->dpy, pixmap); 1198 XFreePixmap (target->dpy, pixmap);
1131 pixmap = None; 1199 pixmap = None;
1132 } 1200 }
1201
1133 if (pixmap == None) 1202 if (pixmap == None)
1134 { 1203 {
1135 pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth); 1204 pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth);
1136 pmap_width = result->width; 1205 pmap_width = result->width;
1137 pmap_height = result->height; 1206 pmap_height = result->height;
1138 pmap_depth = target->depth; 1207 pmap_depth = target->depth;
1139 } 1208 }
1209
1140 if (pmap_depth != result->depth) 1210 if (pmap_depth != result->depth)
1211 {
1141 { /* Bad Match error will ensue ! stupid X !!!! */ 1212 /* Bad Match error will ensue ! stupid X !!!! */
1142 if( result->depth == 24 && pmap_depth == 32) 1213 if (result->depth == 24 && pmap_depth == 32)
1143 result->depth = 32; 1214 result->depth = 32;
1144 else if( result->depth == 32 && pmap_depth == 24) 1215 else if (result->depth == 32 && pmap_depth == 24)
1145 result->depth = 24; 1216 result->depth = 24;
1146 else 1217 else
1147 { 1218 {
1148 /* TODO: implement image recoding */ 1219 /* TODO: implement image recoding */
1149 } 1220 }
1150 } 1221 }
1222
1151 if (pmap_depth == result->depth) 1223 if (pmap_depth == result->depth)
1152 XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); 1224 XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height);
1225
1153 XFreeGC (target->dpy, gc); 1226 XFreeGC (target->dpy, gc);
1154 flags = flags & ~isInvalid; 1227 flags = flags & ~isInvalid;
1155 } 1228 }
1229
1156 XDestroyImage (result); 1230 XDestroyImage (result);
1157 } 1231 }
1158 1232
1159 if (flags & isInvalid) 1233 if (flags & isInvalid)
1160 { 1234 {
1165 } 1239 }
1166 } 1240 }
1167 1241
1168 apply (); 1242 apply ();
1169 1243
1244 XSync (target->dpy, False);
1245 valid_since = ev::now ();
1246
1247 TIMING_TEST_PRINT_RESULT (tp);
1248
1170 return true; 1249 return true;
1171} 1250}
1172 1251
1173bool 1252bool
1174bgPixmap_t::set_target (rxvt_term *new_target) 1253bgPixmap_t::set_target (rxvt_term *new_target)
1175{ 1254{
1176 if (new_target) 1255 if (new_target)
1177 if (target != new_target) 1256 if (target != new_target)
1178 { 1257 {
1184 } 1263 }
1185 return false; 1264 return false;
1186} 1265}
1187 1266
1188void 1267void
1189bgPixmap_t::apply() 1268bgPixmap_t::apply ()
1190{ 1269{
1191 if (target) 1270 if (target)
1192 { 1271 {
1193 flags &= ~isVtOrigin; 1272 flags &= ~isVtOrigin;
1194 if (pixmap != None) 1273 if (pixmap != None)
1274 {
1195 { /* set target's background to pixmap */ 1275 /* set target's background to pixmap */
1196# ifdef ENABLE_TRANSPARENCY 1276# ifdef ENABLE_TRANSPARENCY
1197 if (flags & isTransparent) 1277 if (flags & isTransparent)
1198 { 1278 {
1199 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap); 1279 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap);
1200 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative); 1280 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative);
1216 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); 1296 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1217# endif 1297# endif
1218 } 1298 }
1219 } 1299 }
1220 else 1300 else
1301 {
1221 { /* set target background to a pixel */ 1302 /* set target background to a pixel */
1222 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); 1303 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1223 XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]); 1304 XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]);
1224 /* do we also need to set scrollbar's background here ? */ 1305 /* do we also need to set scrollbar's background here ? */
1225# if HAVE_SCROLLBARS 1306# if HAVE_SCROLLBARS
1226 if (target->scrollBar.win) 1307 if (target->scrollBar.win)
1227 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); 1308 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1228# endif 1309# endif
1229 } 1310 }
1230 1311 /* don't want Expose on the parent or vt. It is better to use
1231 /* don't want Expose on the parent */ 1312 scr_touch or we get a great deal of flicker otherwise: */
1232 XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); 1313 XClearWindow (target->dpy, target->parent[0]);
1233 /* do want Expose on the vt, so we get refreshed properly */
1234 XClearArea (target->dpy, target->vt, 0, 0, 0, 0, True);
1235 1314
1236# if HAVE_SCROLLBARS 1315# if HAVE_SCROLLBARS
1237 if (target->scrollBar.win) 1316 if (target->scrollBar.win)
1238 { 1317 {
1239 target->scrollBar.setIdle (); 1318 target->scrollBar.setIdle ();
1240 target->scrollbar_show (0); 1319 target->scrollbar_show (0);
1241 } 1320 }
1242# endif 1321# endif
1243 }
1244}
1245 1322
1323 target->want_refresh = 1;
1324 flags |= hasChanged;
1325 }
1326}
1327
1246#endif /* HAVE_BG_PIXMAP */ 1328#endif /* HAVE_BG_PIXMAP */
1247 1329
1248#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) 1330#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT
1249/* taken from aterm-0.4.2 */ 1331/* taken from aterm-0.4.2 */
1250 1332
1251typedef uint32_t RUINT32T; 1333typedef uint32_t RUINT32T;
1252 1334
1253static void 1335static void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines