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.101 by sf-exg, Sun Oct 31 08:28:04 2010 UTC vs.
Revision 1.110 by sf-exg, Wed Nov 3 11:58:03 2010 UTC

23 *---------------------------------------------------------------------*/ 23 *---------------------------------------------------------------------*/
24 24
25#include <cmath> 25#include <cmath>
26#include "../config.h" /* NECESSARY */ 26#include "../config.h" /* NECESSARY */
27#include "rxvt.h" /* NECESSARY */ 27#include "rxvt.h" /* NECESSARY */
28
29#if XRENDER
30# include <X11/extensions/Xrender.h>
31#endif
28 32
29#define DO_TIMING_TEST 0 33#define DO_TIMING_TEST 0
30 34
31#if DO_TIMING_TEST 35#if DO_TIMING_TEST
32# include <sys/time.h> 36# include <sys/time.h>
250} 254}
251 255
252bool 256bool
253bgPixmap_t::set_geometry (const char *geom) 257bgPixmap_t::set_geometry (const char *geom)
254{ 258{
259 bool changed = false;
255 int geom_flags = 0, changed = 0; 260 int geom_flags = 0;
256 int x = 0, y = 0; 261 int x = 0, y = 0;
257 unsigned int w = 0, h = 0; 262 unsigned int w = 0, h = 0;
258 unsigned int n; 263 unsigned int n;
259 unsigned long new_flags = (flags & (~geometryFlags)); 264 unsigned long new_flags = (flags & (~geometryFlags));
260 const char *p; 265 const char *p;
416 421
417 while (*ops != ':' && *ops != '\0') ++ops; 422 while (*ops != ':' && *ops != '\0') ++ops;
418 } /* done parsing ops */ 423 } /* done parsing ops */
419 } 424 }
420 425
421 if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) ++changed; 426 if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true;
422 if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) ++changed; 427 if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true;
423 if (check_set_align_value (geom_flags, XValue, h_align, x)) ++changed; 428 if (check_set_align_value (geom_flags, XValue, h_align, x)) changed = true;
424 if (check_set_align_value (geom_flags, YValue, v_align, y)) ++changed; 429 if (check_set_align_value (geom_flags, YValue, v_align, y)) changed = true;
425 } 430 }
426 431
427 if (new_flags != flags) 432 if (new_flags != flags)
428 { 433 {
429 flags = new_flags; 434 flags = new_flags;
430 changed++; 435 changed = true;
431 } 436 }
432 437
433 return (changed > 0); 438 return changed;
434} 439}
435 440
436void 441void
437bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) 442bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y)
438{ 443{
729 return false; 734 return false;
730 735
731 if (!pixbuf) 736 if (!pixbuf)
732 return false; 737 return false;
733 738
734#if !XRENDER
735 if (background_flags) 739 if (background_flags
740 && !(flags & HAS_RENDER))
736 return false; 741 return false;
737#endif
738 742
739 GdkPixbuf *result; 743 GdkPixbuf *result;
740 744
741 int image_width = gdk_pixbuf_get_width (pixbuf); 745 int image_width = gdk_pixbuf_get_width (pixbuf);
742 int image_height = gdk_pixbuf_get_height (pixbuf); 746 int image_height = gdk_pixbuf_get_height (pixbuf);
862 if (background_flags) 866 if (background_flags)
863 { 867 {
864 Display *dpy = target->dpy; 868 Display *dpy = target->dpy;
865 XRenderPictureAttributes pa; 869 XRenderPictureAttributes pa;
866 870
867 XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, target->display->screen)); 871 XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, target->visual);
868 Picture src = XRenderCreatePicture (dpy, root_pmap, src_format, 0, &pa); 872 Picture src = XRenderCreatePicture (dpy, root_pmap, src_format, 0, &pa);
869 873
870 XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, target->visual); 874 XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, target->visual);
871 Picture dst = XRenderCreatePicture (dpy, pixmap, dst_format, 0, &pa); 875 Picture dst = XRenderCreatePicture (dpy, pixmap, dst_format, 0, &pa);
872 876
909# endif /* HAVE_PIXBUF */ 913# endif /* HAVE_PIXBUF */
910 914
911bool 915bool
912bgPixmap_t::set_file (const char *file) 916bgPixmap_t::set_file (const char *file)
913{ 917{
914 assert (file); 918 if (!file || !*file)
919 return false;
915 920
916 if (*file)
917 {
918 if (const char *p = strchr (file, ';')) 921 if (const char *p = strchr (file, ';'))
919 { 922 {
920 size_t len = p - file; 923 size_t len = p - file;
921 char *f = rxvt_temp_buf<char> (len + 1); 924 char *f = rxvt_temp_buf<char> (len + 1);
922 memcpy (f, file, len); 925 memcpy (f, file, len);
923 f[len] = '\0'; 926 f[len] = '\0';
924 file = f; 927 file = f;
925 } 928 }
926 929
927# ifdef HAVE_AFTERIMAGE 930# ifdef HAVE_AFTERIMAGE
928 if (!target->asimman) 931 if (!target->asimman)
929 target->asimman = create_generic_imageman (target->rs[Rs_path]); 932 target->asimman = create_generic_imageman (target->rs[Rs_path]);
930 ASImage *image = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); 933 ASImage *image = get_asimage (target->asimman, file, 0xFFFFFFFF, 100);
931 if (image) 934 if (image)
932 { 935 {
933 if (original_asim) 936 if (original_asim)
934 safe_asimage_destroy (original_asim); 937 safe_asimage_destroy (original_asim);
935 original_asim = image; 938 original_asim = image;
936 have_image = true; 939 have_image = true;
937 return true; 940 return true;
938 } 941 }
939# endif 942# endif
940 943
941# ifdef HAVE_PIXBUF 944# ifdef HAVE_PIXBUF
942 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); 945 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL);
943 if (image) 946 if (image)
944 { 947 {
945 if (pixbuf) 948 if (pixbuf)
946 g_object_unref (pixbuf); 949 g_object_unref (pixbuf);
947 pixbuf = image; 950 pixbuf = image;
948 have_image = true; 951 have_image = true;
949 return true; 952 return true;
950 } 953 }
951# endif 954# endif
952 }
953 955
954 return false; 956 return false;
955} 957}
956 958
957# endif /* BG_IMAGE_FROM_FILE */ 959# endif /* BG_IMAGE_FROM_FILE */
970} 972}
971 973
972bool 974bool
973bgPixmap_t::set_blur_radius (const char *geom) 975bgPixmap_t::set_blur_radius (const char *geom)
974{ 976{
975 int changed = 0; 977 bool changed = false;
976 unsigned int hr, vr; 978 unsigned int hr, vr;
977 int junk; 979 int junk;
978 int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr); 980 int geom_flags = XParseGeometry (geom, &junk, &junk, &hr, &vr);
979 981
980 if (!(geom_flags & WidthValue)) 982 if (!(geom_flags & WidthValue))
985 min_it (hr, 128); 987 min_it (hr, 128);
986 min_it (vr, 128); 988 min_it (vr, 128);
987 989
988 if (h_blurRadius != hr) 990 if (h_blurRadius != hr)
989 { 991 {
990 ++changed; 992 changed = true;
991 h_blurRadius = hr; 993 h_blurRadius = hr;
992 } 994 }
993 995
994 if (v_blurRadius != vr) 996 if (v_blurRadius != vr)
995 { 997 {
996 ++changed; 998 changed = true;
997 v_blurRadius = vr; 999 v_blurRadius = vr;
998 } 1000 }
999 1001
1000 if (v_blurRadius == 0 && h_blurRadius == 0) 1002 if (v_blurRadius == 0 && h_blurRadius == 0)
1001 flags &= ~blurNeeded; 1003 flags &= ~blurNeeded;
1002 else 1004 else
1003 flags |= blurNeeded; 1005 flags |= blurNeeded;
1004 1006
1005#if XRENDER
1006 XFilters *filters = XRenderQueryFilters (target->dpy, target->display->root);
1007 if (filters)
1008 {
1009 for (int i = 0; i < filters->nfilter; i++)
1010 if (!strcmp (filters->filter[i], FilterConvolution))
1011 flags |= bgPixmap_t::blurServerSide;
1012
1013 XFree (filters);
1014 }
1015#endif
1016
1017 return (changed > 0); 1007 return changed;
1018} 1008}
1019 1009
1020static inline unsigned long 1010static inline unsigned long
1021compute_tint_shade_flags (rxvt_color *tint, int shade) 1011compute_tint_shade_flags (rxvt_color *tint, int shade)
1022{ 1012{
1041 { 1031 {
1042 if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700) 1032 if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700)
1043 && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) 1033 && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700))
1044 { 1034 {
1045 flags |= bgPixmap_t::tintNeeded; 1035 flags |= bgPixmap_t::tintNeeded;
1046 }
1047 }
1048
1049 if (flags & bgPixmap_t::tintNeeded)
1050 {
1051 if (flags & bgPixmap_t::tintWholesome)
1052 flags |= bgPixmap_t::tintServerSide;
1053 else
1054 {
1055#if XRENDER
1056 flags |= bgPixmap_t::tintServerSide;
1057#endif
1058 } 1036 }
1059 } 1037 }
1060 1038
1061 return flags; 1039 return flags;
1062} 1040}
1299 return 0; 1277 return 0;
1300 1278
1301 /* root dimensions may change from call to call - but Display structure should 1279 /* root dimensions may change from call to call - but Display structure should
1302 * be always up-to-date, so let's use it : 1280 * be always up-to-date, so let's use it :
1303 */ 1281 */
1304 Window root = target->display->root;
1305 int screen = target->display->screen; 1282 int screen = target->display->screen;
1306 Display *dpy = target->dpy; 1283 Display *dpy = target->dpy;
1284 int root_depth = DefaultDepth (dpy, screen);
1307 int root_width = DisplayWidth (dpy, screen); 1285 int root_width = DisplayWidth (dpy, screen);
1308 int root_height = DisplayHeight (dpy, screen); 1286 int root_height = DisplayHeight (dpy, screen);
1287 unsigned int root_pmap_width, root_pmap_height;
1309 int window_width = target->szHint.width; 1288 int window_width = target->szHint.width;
1310 int window_height = target->szHint.height; 1289 int window_height = target->szHint.height;
1311 int sx, sy; 1290 int sx, sy;
1312 XGCValues gcv; 1291 XGCValues gcv;
1313 GC gc; 1292 GC gc;
1317 /* check if we are outside of the visible part of the virtual screen : */ 1296 /* check if we are outside of the visible part of the virtual screen : */
1318 if (sx + window_width <= 0 || sy + window_height <= 0 1297 if (sx + window_width <= 0 || sy + window_height <= 0
1319 || sx >= root_width || sy >= root_height) 1298 || sx >= root_width || sy >= root_height)
1320 return 0; 1299 return 0;
1321 1300
1301 // validate root pixmap and get its size
1302 if (root_pixmap != None)
1303 {
1304 Window wdummy;
1305 int idummy;
1306 unsigned int udummy;
1307
1308 target->allowedxerror = -1;
1309
1310 if (!XGetGeometry (dpy, root_pixmap, &wdummy, &idummy, &idummy, &root_pmap_width, &root_pmap_height, &udummy, &udummy))
1311 root_pixmap = None;
1312
1313 target->allowedxerror = 0;
1314 }
1315
1316 Pixmap recoded_root_pmap = root_pixmap;
1317
1318 if (root_pixmap != None && root_depth != target->depth)
1319 {
1320#if XRENDER
1321 if (flags & HAS_RENDER)
1322 {
1323 XRenderPictureAttributes pa;
1324
1325 XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen));
1326 Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa);
1327
1328 recoded_root_pmap = XCreatePixmap (dpy, target->vt, root_pmap_width, root_pmap_height, target->depth);
1329 XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, target->visual);
1330 Picture dst = XRenderCreatePicture (dpy, recoded_root_pmap, dst_format, 0, &pa);
1331
1332 if (src && dst)
1333 XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, root_pmap_width, root_pmap_height);
1334 else
1335 {
1336 XFreePixmap (dpy, recoded_root_pmap);
1337 root_pixmap = None;
1338 }
1339
1340 XRenderFreePicture (dpy, src);
1341 XRenderFreePicture (dpy, dst);
1342 }
1343 else
1344#endif
1345 root_pixmap = None;
1346 }
1347
1322 if (root_pixmap == None) 1348 if (root_pixmap == None)
1323 return 0; 1349 return 0;
1324 1350
1325 Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); 1351 Pixmap tiled_root_pmap = XCreatePixmap (dpy, target->vt, window_width, window_height, target->depth);
1326 1352
1327 if (tiled_root_pmap == None) /* something really bad happened - abort */ 1353 if (tiled_root_pmap == None) /* something really bad happened - abort */
1328 return 0; 1354 return 0;
1329 1355
1330 /* straightforward pixmap copy */ 1356 /* straightforward pixmap copy */
1331 gcv.tile = root_pixmap; 1357 gcv.tile = recoded_root_pmap;
1332 gcv.fill_style = FillTiled; 1358 gcv.fill_style = FillTiled;
1333 1359
1334 while (sx < 0) sx += (int)root_width; 1360 while (sx < 0) sx += (int)root_width;
1335 while (sy < 0) sy += (int)root_height; 1361 while (sy < 0) sy += (int)root_height;
1336 1362
1337 gcv.ts_x_origin = -sx; 1363 gcv.ts_x_origin = -sx;
1338 gcv.ts_y_origin = -sy; 1364 gcv.ts_y_origin = -sy;
1339 gc = XCreateGC (dpy, root, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); 1365 gc = XCreateGC (dpy, target->vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
1340 1366
1341 if (gc) 1367 if (gc)
1342 { 1368 {
1343 XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); 1369 XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height);
1344 result |= transpPmapTiled; 1370 result |= transpPmapTiled;
1347 1373
1348 if (tiled_root_pmap != None) 1374 if (tiled_root_pmap != None)
1349 { 1375 {
1350 if (!need_client_side_rendering ()) 1376 if (!need_client_side_rendering ())
1351 { 1377 {
1352 if (flags & (blurNeeded | blurServerSide)) 1378 if ((flags & blurNeeded)
1379 && (flags & HAS_RENDER_CONV))
1353 { 1380 {
1354 if (blur_pixmap (tiled_root_pmap, DefaultVisual (dpy, screen), window_width, window_height)) 1381 if (blur_pixmap (tiled_root_pmap, target->visual, window_width, window_height))
1355 result |= transpPmapBlurred; 1382 result |= transpPmapBlurred;
1356 } 1383 }
1357 if (flags & (tintNeeded | tintServerSide)) 1384 if ((flags & tintNeeded)
1385 && (flags & (tintWholesome | HAS_RENDER)))
1358 { 1386 {
1359 if (tint_pixmap (tiled_root_pmap, DefaultVisual (dpy, screen), window_width, window_height)) 1387 if (tint_pixmap (tiled_root_pmap, target->visual, window_width, window_height))
1360 result |= transpPmapTinted; 1388 result |= transpPmapTinted;
1361 } 1389 }
1362 } /* server side rendering completed */ 1390 } /* server side rendering completed */
1363 1391
1364 if (pixmap) 1392 if (pixmap)
1365 XFreePixmap (dpy, pixmap); 1393 XFreePixmap (dpy, pixmap);
1366 1394
1367 pixmap = tiled_root_pmap; 1395 pixmap = tiled_root_pmap;
1368 pmap_width = window_width; 1396 pmap_width = window_width;
1369 pmap_height = window_height; 1397 pmap_height = window_height;
1370 pmap_depth = root_depth; 1398 pmap_depth = target->depth;
1371 } 1399 }
1400
1401 if (recoded_root_pmap != root_pixmap)
1402 XFreePixmap (dpy, recoded_root_pmap);
1372 1403
1373 return result; 1404 return result;
1374} 1405}
1375 1406
1376void 1407void
1379 Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); 1410 Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID);
1380 if (new_root_pixmap == None) 1411 if (new_root_pixmap == None)
1381 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); 1412 new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID);
1382 1413
1383 root_pixmap = new_root_pixmap; 1414 root_pixmap = new_root_pixmap;
1384
1385 // validate root pixmap
1386 if (root_pixmap != None)
1387 {
1388 unsigned int width, height;
1389 Window wdummy;
1390 int idummy;
1391 unsigned int udummy;
1392
1393 target->allowedxerror = -1;
1394
1395 if (!XGetGeometry (target->dpy, root_pixmap, &wdummy, &idummy, &idummy, &width, &height, &udummy, &udummy))
1396 root_pixmap = None;
1397
1398 target->allowedxerror = 0;
1399 }
1400} 1415}
1401# endif /* ENABLE_TRANSPARENCY */ 1416# endif /* ENABLE_TRANSPARENCY */
1402 1417
1403# ifndef HAVE_AFTERIMAGE 1418# ifndef HAVE_AFTERIMAGE
1404static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm); 1419static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm);
1418 { 1433 {
1419 /* we need to re-generate transparency pixmap in that case ! */ 1434 /* we need to re-generate transparency pixmap in that case ! */
1420 background_flags = make_transparency_pixmap (); 1435 background_flags = make_transparency_pixmap ();
1421 if (background_flags == 0) 1436 if (background_flags == 0)
1422 return false; 1437 return false;
1423 else if ((background_flags & transpTransformations) == (flags & transpTransformations) 1438 else if ((background_flags & transpTransformations) == (flags & transpTransformations))
1424 && pmap_depth == target->depth)
1425 flags = flags & ~isInvalid; 1439 flags = flags & ~isInvalid;
1426 } 1440 }
1427# endif 1441# endif
1428 1442
1429# ifdef BG_IMAGE_FROM_FILE 1443# ifdef BG_IMAGE_FROM_FILE
1457 1471
1458 GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL); 1472 GC gc = XCreateGC (target->dpy, target->vt, 0UL, NULL);
1459 1473
1460 if (gc) 1474 if (gc)
1461 { 1475 {
1462 if (/*pmap_depth != target->depth &&*/ pixmap != None)
1463 {
1464 XFreePixmap (target->dpy, pixmap);
1465 pixmap = None;
1466 }
1467
1468 if (pixmap == None)
1469 {
1470 pixmap = XCreatePixmap (target->dpy, target->vt, result->width, result->height, target->depth);
1471 pmap_width = result->width;
1472 pmap_height = result->height;
1473 pmap_depth = target->depth;
1474 }
1475
1476 if (pmap_depth != result->depth)
1477 {
1478 /* Bad Match error will ensue ! stupid X !!!! */
1479 if (result->depth == 24 && pmap_depth == 32)
1480 result->depth = 32;
1481 else if (result->depth == 32 && pmap_depth == 24)
1482 result->depth = 24;
1483 else
1484 {
1485 /* TODO: implement image recoding */
1486 }
1487 }
1488
1489 if (pmap_depth == result->depth)
1490 XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); 1476 XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height);
1491 1477
1492 XFreeGC (target->dpy, gc); 1478 XFreeGC (target->dpy, gc);
1493 flags = flags & ~isInvalid; 1479 flags = flags & ~isInvalid;
1494 } 1480 }
1495 1481
1510 valid_since = ev::now (); 1496 valid_since = ev::now ();
1511 1497
1512 return true; 1498 return true;
1513} 1499}
1514 1500
1515bool 1501void
1516bgPixmap_t::set_target (rxvt_term *new_target) 1502bgPixmap_t::set_target (rxvt_term *new_target)
1517{ 1503{
1518 if (new_target)
1519 if (target != new_target)
1520 {
1521 target = new_target; 1504 target = new_target;
1522# ifdef ENABLE_TRANSPARENCY 1505
1523 root_depth = DefaultDepthOfScreen (ScreenOfDisplay (target->dpy, target->display->screen)); 1506 flags &= ~(HAS_RENDER | HAS_RENDER_CONV);
1507#if XRENDER
1508 int major, minor;
1509 if (XRenderQueryVersion (target->dpy, &major, &minor))
1510 flags |= HAS_RENDER;
1511 XFilters *filters = XRenderQueryFilters (target->dpy, target->vt);
1512 if (filters)
1513 {
1514 for (int i = 0; i < filters->nfilter; i++)
1515 if (!strcmp (filters->filter[i], FilterConvolution))
1516 flags |= HAS_RENDER_CONV;
1517
1518 XFree (filters);
1519 }
1524# endif 1520#endif
1525 return true;
1526 }
1527
1528 return false;
1529} 1521}
1530 1522
1531void 1523void
1532bgPixmap_t::apply () 1524bgPixmap_t::apply ()
1533{ 1525{
1534 if (target) 1526 if (target == NULL)
1535 { 1527 return;
1528
1536 if (pixmap != None) 1529 if (pixmap != None)
1537 { 1530 {
1538 /* set target's background to pixmap */ 1531 /* set target's background to pixmap */
1539# ifdef ENABLE_TRANSPARENCY 1532# ifdef ENABLE_TRANSPARENCY
1540 if (flags & isTransparent) 1533 if (flags & isTransparent)
1541 { 1534 {
1542 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap); 1535 XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap);
1543 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative); 1536 XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative);
1544 1537
1545 if (target->scrollBar.win) 1538 if (target->scrollBar.win)
1546 XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); 1539 XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative);
1547 } 1540 }
1548 else 1541 else
1549# endif 1542# endif
1550 { 1543 {
1551 /* force old pixmap dereference in case it was transparent before :*/ 1544 /* force old pixmap dereference in case it was transparent before :*/
1552 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1553 XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap);
1554 /* do we also need to set scrollbar's background here ? */
1555
1556 if (target->scrollBar.win)
1557 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1558 }
1559 }
1560 else
1561 {
1562 /* set target background to a pixel */
1563 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); 1545 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1564 XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]); 1546 XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap);
1565 /* do we also need to set scrollbar's background here ? */ 1547 /* do we also need to set scrollbar's background here ? */
1548
1566 if (target->scrollBar.win) 1549 if (target->scrollBar.win)
1567 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); 1550 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1568 } 1551 }
1552 }
1553 else
1554 {
1555 /* set target background to a pixel */
1556 XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]);
1557 XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]);
1558 /* do we also need to set scrollbar's background here ? */
1559 if (target->scrollBar.win)
1560 XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
1561 }
1569 1562
1570 /* don't want Expose on the parent or vt. It is better to use 1563 /* don't want Expose on the parent or vt. It is better to use
1571 scr_touch or we get a great deal of flicker otherwise: */ 1564 scr_touch or we get a great deal of flicker otherwise: */
1572 XClearWindow (target->dpy, target->parent[0]); 1565 XClearWindow (target->dpy, target->parent[0]);
1573 1566
1574 if (target->scrollBar.state && target->scrollBar.win) 1567 if (target->scrollBar.state && target->scrollBar.win)
1575 { 1568 {
1576 target->scrollBar.state = STATE_IDLE; 1569 target->scrollBar.state = STATE_IDLE;
1577 target->scrollBar.show (0); 1570 target->scrollBar.show (0);
1578 } 1571 }
1579 1572
1580 target->want_refresh = 1; 1573 target->want_refresh = 1;
1581 flags |= hasChanged; 1574 flags |= hasChanged;
1582 }
1583} 1575}
1584 1576
1585#endif /* HAVE_BG_PIXMAP */ 1577#endif /* HAVE_BG_PIXMAP */
1586 1578
1587#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XRENDER 1579#if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XRENDER

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines