… | |
… | |
79 | #ifdef ENABLE_TRANSPARENCY |
79 | #ifdef ENABLE_TRANSPARENCY |
80 | shade = 100; |
80 | shade = 100; |
81 | #endif |
81 | #endif |
82 | flags = 0; |
82 | flags = 0; |
83 | pixmap = None; |
83 | pixmap = None; |
84 | valid_since = invalid_since = 0; |
84 | valid_since = 0; |
85 | target = 0; |
85 | target = 0; |
86 | target_x = target_y = 0; |
86 | target_x = target_y = 0; |
87 | } |
87 | } |
88 | |
88 | |
89 | void |
89 | void |
… | |
… | |
1024 | |
1024 | |
1025 | if (new_shade != shade) |
1025 | if (new_shade != shade) |
1026 | { |
1026 | { |
1027 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
1027 | unsigned long new_flags = compute_tint_shade_flags ((flags & tintSet) ? &tint : NULL, new_shade); |
1028 | shade = new_shade; |
1028 | shade = new_shade; |
1029 | flags = (flags & (~tintFlags | tintSet)) | new_flags; |
1029 | flags = (flags & ~tintFlags) | new_flags; |
1030 | return true; |
1030 | return true; |
1031 | } |
1031 | } |
1032 | |
1032 | |
1033 | return false; |
1033 | return false; |
1034 | } |
1034 | } |
… | |
… | |
1388 | /* we need to re-generate transparency pixmap in that case ! */ |
1388 | /* we need to re-generate transparency pixmap in that case ! */ |
1389 | background_flags = make_transparency_pixmap (); |
1389 | background_flags = make_transparency_pixmap (); |
1390 | if (background_flags == 0) |
1390 | if (background_flags == 0) |
1391 | return false; |
1391 | return false; |
1392 | else if ((background_flags & transpTransformations) == (flags & transpTransformations)) |
1392 | else if ((background_flags & transpTransformations) == (flags & transpTransformations)) |
1393 | flags &= ~isInvalid; |
1393 | flags |= isValid; |
1394 | } |
1394 | } |
1395 | # endif |
1395 | # endif |
1396 | |
1396 | |
1397 | # ifdef BG_IMAGE_FROM_FILE |
1397 | # ifdef BG_IMAGE_FROM_FILE |
1398 | if (have_image |
1398 | if (have_image |
1399 | || (background_flags & transpTransformations) != (flags & transpTransformations)) |
1399 | || (background_flags & transpTransformations) != (flags & transpTransformations)) |
1400 | { |
1400 | { |
1401 | if (render_image (background_flags)) |
1401 | if (render_image (background_flags)) |
1402 | flags &= ~isInvalid; |
1402 | flags |= isValid; |
1403 | } |
1403 | } |
1404 | # endif |
1404 | # endif |
1405 | |
1405 | |
1406 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1406 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1407 | XImage *result = NULL; |
1407 | XImage *result = NULL; |
1408 | |
1408 | |
1409 | if (background_flags && (flags & isInvalid)) |
1409 | if (background_flags && !(flags & isValid)) |
1410 | { |
1410 | { |
1411 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1411 | result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); |
1412 | } |
1412 | } |
1413 | |
1413 | |
1414 | if (result) |
1414 | if (result) |
… | |
… | |
1427 | if (gc) |
1427 | if (gc) |
1428 | { |
1428 | { |
1429 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1429 | XPutImage (target->dpy, pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1430 | |
1430 | |
1431 | XFreeGC (target->dpy, gc); |
1431 | XFreeGC (target->dpy, gc); |
1432 | flags &= ~isInvalid; |
1432 | flags |= isValid; |
1433 | } |
1433 | } |
1434 | |
1434 | |
1435 | XDestroyImage (result); |
1435 | XDestroyImage (result); |
1436 | } |
1436 | } |
1437 | # endif |
1437 | # endif |
1438 | |
1438 | |
1439 | if (flags & isInvalid) |
1439 | if (!(flags & isValid)) |
1440 | { |
1440 | { |
1441 | if (pixmap != None) |
1441 | if (pixmap != None) |
1442 | { |
1442 | { |
1443 | XFreePixmap (target->dpy, pixmap); |
1443 | XFreePixmap (target->dpy, pixmap); |
1444 | pixmap = None; |
1444 | pixmap = None; |
1445 | } |
1445 | } |
1446 | } |
1446 | } |
1447 | |
1447 | |
1448 | apply (); |
1448 | target->scr_recolour (false); |
|
|
1449 | flags |= hasChanged; |
1449 | |
1450 | |
1450 | valid_since = ev::now (); |
1451 | valid_since = ev::now (); |
1451 | |
1452 | |
1452 | return true; |
1453 | return true; |
1453 | } |
1454 | } |
… | |
… | |
1470 | flags |= HAS_RENDER_CONV; |
1471 | flags |= HAS_RENDER_CONV; |
1471 | |
1472 | |
1472 | XFree (filters); |
1473 | XFree (filters); |
1473 | } |
1474 | } |
1474 | #endif |
1475 | #endif |
1475 | } |
|
|
1476 | |
|
|
1477 | void |
|
|
1478 | bgPixmap_t::apply () |
|
|
1479 | { |
|
|
1480 | if (target == NULL) |
|
|
1481 | return; |
|
|
1482 | |
|
|
1483 | if (pixmap != None) |
|
|
1484 | { |
|
|
1485 | /* set target's background to pixmap */ |
|
|
1486 | # ifdef ENABLE_TRANSPARENCY |
|
|
1487 | if (flags & isTransparent) |
|
|
1488 | { |
|
|
1489 | XSetWindowBackgroundPixmap (target->dpy, target->parent[0], pixmap); |
|
|
1490 | XSetWindowBackgroundPixmap (target->dpy, target->vt, ParentRelative); |
|
|
1491 | |
|
|
1492 | if (target->scrollBar.win) |
|
|
1493 | XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); |
|
|
1494 | } |
|
|
1495 | else |
|
|
1496 | # endif |
|
|
1497 | { |
|
|
1498 | /* force old pixmap dereference in case it was transparent before :*/ |
|
|
1499 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
|
|
1500 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
|
|
1501 | /* do we also need to set scrollbar's background here ? */ |
|
|
1502 | |
|
|
1503 | if (target->scrollBar.win) |
|
|
1504 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
|
|
1505 | } |
|
|
1506 | } |
|
|
1507 | else |
|
|
1508 | { |
|
|
1509 | /* set target background to a pixel */ |
|
|
1510 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
|
|
1511 | XSetWindowBackground (target->dpy, target->vt, target->pix_colors[Color_bg]); |
|
|
1512 | /* do we also need to set scrollbar's background here ? */ |
|
|
1513 | if (target->scrollBar.win) |
|
|
1514 | XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); |
|
|
1515 | } |
|
|
1516 | |
|
|
1517 | /* don't want Expose on the parent or vt. It is better to use |
|
|
1518 | scr_touch or we get a great deal of flicker otherwise: */ |
|
|
1519 | XClearWindow (target->dpy, target->parent[0]); |
|
|
1520 | |
|
|
1521 | if (target->scrollBar.state && target->scrollBar.win) |
|
|
1522 | { |
|
|
1523 | target->scrollBar.state = STATE_IDLE; |
|
|
1524 | target->scrollBar.show (0); |
|
|
1525 | } |
|
|
1526 | |
|
|
1527 | target->want_refresh = 1; |
|
|
1528 | flags |= hasChanged; |
|
|
1529 | } |
1476 | } |
1530 | |
1477 | |
1531 | #endif /* HAVE_BG_PIXMAP */ |
1478 | #endif /* HAVE_BG_PIXMAP */ |
1532 | |
1479 | |
1533 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1480 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |