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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines