… | |
… | |
396 | |
396 | |
397 | # ifdef ENABLE_TRANSPARENCY |
397 | # ifdef ENABLE_TRANSPARENCY |
398 | if (background_flags) |
398 | if (background_flags) |
399 | background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); |
399 | background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); |
400 | |
400 | |
401 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
401 | if (background_flags & tintNeeded) |
402 | { |
402 | { |
403 | ShadingInfo as_shade; |
403 | ShadingInfo as_shade; |
404 | as_shade.shading = shade; |
404 | as_shade.shading = shade; |
405 | |
405 | |
406 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
406 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
… | |
… | |
411 | as_shade.tintColor.blue = c.b; |
411 | as_shade.tintColor.blue = c.b; |
412 | |
412 | |
413 | background_tint = shading2tint32 (&as_shade); |
413 | background_tint = shading2tint32 (&as_shade); |
414 | } |
414 | } |
415 | |
415 | |
416 | if (!(background_flags & transpPmapBlurred) && (flags & blurNeeded) && background != NULL) |
416 | if ((background_flags & blurNeeded) && background != NULL) |
417 | { |
417 | { |
418 | ASImage *tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
418 | ASImage *tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
419 | (original_asim == NULL || tint == TINT_LEAVE_SAME) ? ASA_XImage : ASA_ASImage, |
419 | (original_asim == NULL || tint == TINT_LEAVE_SAME) ? ASA_XImage : ASA_ASImage, |
420 | 100, ASIMAGE_QUALITY_DEFAULT); |
420 | 100, ASIMAGE_QUALITY_DEFAULT); |
421 | if (tmp) |
421 | if (tmp) |
… | |
… | |
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 | } |
… | |
… | |
1330 | gc = XCreateGC (dpy, target->vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1330 | gc = XCreateGC (dpy, target->vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1331 | |
1331 | |
1332 | if (gc) |
1332 | if (gc) |
1333 | { |
1333 | { |
1334 | XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height); |
1334 | XFillRectangle (dpy, pixmap, gc, 0, 0, window_width, window_height); |
1335 | result |= transpPmapTiled; |
1335 | result |= isValid | (flags & effectsFlags); |
1336 | XFreeGC (dpy, gc); |
1336 | XFreeGC (dpy, gc); |
1337 | |
1337 | |
1338 | if (!(flags & CLIENT_RENDER)) |
1338 | if (!(flags & CLIENT_RENDER)) |
1339 | { |
1339 | { |
1340 | if ((flags & blurNeeded) |
1340 | if ((flags & blurNeeded) |
1341 | && (flags & HAS_RENDER_CONV)) |
1341 | && (flags & HAS_RENDER_CONV)) |
1342 | { |
1342 | { |
1343 | if (blur_pixmap (pixmap, target->visual, window_width, window_height)) |
1343 | if (blur_pixmap (pixmap, target->visual, window_width, window_height)) |
1344 | result |= transpPmapBlurred; |
1344 | result &= ~blurNeeded; |
1345 | } |
1345 | } |
1346 | if ((flags & tintNeeded) |
1346 | if ((flags & tintNeeded) |
1347 | && (flags & (tintWholesome | HAS_RENDER))) |
1347 | && (flags & (tintWholesome | HAS_RENDER))) |
1348 | { |
1348 | { |
1349 | if (tint_pixmap (pixmap, target->visual, window_width, window_height)) |
1349 | if (tint_pixmap (pixmap, target->visual, window_width, window_height)) |
1350 | result |= transpPmapTinted; |
1350 | result &= ~tintNeeded; |
1351 | } |
1351 | } |
1352 | } /* server side rendering completed */ |
1352 | } /* server side rendering completed */ |
1353 | } |
1353 | } |
1354 | |
1354 | |
1355 | if (recoded_root_pmap != root_pixmap) |
1355 | if (recoded_root_pmap != root_pixmap) |
… | |
… | |
1387 | { |
1387 | { |
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 & effectsFlags)) |
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 & effectsFlags)) |
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) |
1415 | { |
1415 | { |
1416 | /* our own client-side tinting */ |
1416 | /* our own client-side tinting */ |
1417 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1417 | if (background_flags & tintNeeded) |
1418 | { |
1418 | { |
1419 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1419 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1420 | if (flags & tintSet) |
1420 | if (flags & tintSet) |
1421 | tint.get (c); |
1421 | tint.get (c); |
1422 | shade_ximage (DefaultVisual (target->dpy, target->display->screen), result, shade, c); |
1422 | shade_ximage (DefaultVisual (target->dpy, target->display->screen), result, shade, c); |
… | |
… | |
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) |