… | |
… | |
428 | { |
428 | { |
429 | flags = new_flags; |
429 | flags = new_flags; |
430 | changed++; |
430 | changed++; |
431 | } |
431 | } |
432 | |
432 | |
433 | //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
|
|
434 | // flags, h_scale, v_scale, h_align, v_align); |
|
|
435 | return (changed > 0); |
433 | return (changed > 0); |
436 | } |
434 | } |
437 | |
435 | |
438 | void |
436 | void |
439 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
437 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
… | |
… | |
1286 | |
1284 | |
1287 | return ret; |
1285 | return ret; |
1288 | } |
1286 | } |
1289 | |
1287 | |
1290 | /* make_transparency_pixmap() |
1288 | /* make_transparency_pixmap() |
1291 | * Builds a pixmap sized the same as terminal window, with depth same as the root window |
1289 | * Builds a pixmap of the same size as the terminal window that contains |
1292 | * that pixmap contains tiled portion of the root pixmap that is supposed to be covered by |
1290 | * the tiled portion of the root pixmap that is supposed to be covered by |
1293 | * our window. |
1291 | * our window. |
1294 | */ |
1292 | */ |
1295 | unsigned long |
1293 | unsigned long |
1296 | bgPixmap_t::make_transparency_pixmap () |
1294 | bgPixmap_t::make_transparency_pixmap () |
1297 | { |
1295 | { |
… | |
… | |
1306 | Window root = target->display->root; |
1304 | Window root = target->display->root; |
1307 | int screen = target->display->screen; |
1305 | int screen = target->display->screen; |
1308 | Display *dpy = target->dpy; |
1306 | Display *dpy = target->dpy; |
1309 | int root_width = DisplayWidth (dpy, screen); |
1307 | int root_width = DisplayWidth (dpy, screen); |
1310 | int root_height = DisplayHeight (dpy, screen); |
1308 | int root_height = DisplayHeight (dpy, screen); |
1311 | unsigned int root_pmap_width, root_pmap_height; |
|
|
1312 | int window_width = target->szHint.width; |
1309 | int window_width = target->szHint.width; |
1313 | int window_height = target->szHint.height; |
1310 | int window_height = target->szHint.height; |
1314 | int sx, sy; |
1311 | int sx, sy; |
1315 | XGCValues gcv; |
1312 | XGCValues gcv; |
1316 | GC gc; |
1313 | GC gc; |
… | |
… | |
1320 | /* check if we are outside of the visible part of the virtual screen : */ |
1317 | /* check if we are outside of the visible part of the virtual screen : */ |
1321 | if (sx + window_width <= 0 || sy + window_height <= 0 |
1318 | if (sx + window_width <= 0 || sy + window_height <= 0 |
1322 | || sx >= root_width || sy >= root_height) |
1319 | || sx >= root_width || sy >= root_height) |
1323 | return 0; |
1320 | return 0; |
1324 | |
1321 | |
1325 | if (root_pixmap != None) |
|
|
1326 | { |
|
|
1327 | /* we want to validate the pixmap and get its size at the same time : */ |
|
|
1328 | int junk; |
|
|
1329 | unsigned int ujunk; |
|
|
1330 | /* root pixmap may be bad - allow a error */ |
|
|
1331 | target->allowedxerror = -1; |
|
|
1332 | |
|
|
1333 | if (!XGetGeometry (dpy, root_pixmap, &root, &junk, &junk, &root_pmap_width, &root_pmap_height, &ujunk, &ujunk)) |
|
|
1334 | root_pixmap = None; |
|
|
1335 | |
|
|
1336 | target->allowedxerror = 0; |
|
|
1337 | } |
|
|
1338 | |
|
|
1339 | if (root_pixmap == None) |
1322 | if (root_pixmap == None) |
1340 | return 0; |
1323 | return 0; |
1341 | |
1324 | |
1342 | Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); |
1325 | Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); |
1343 | |
1326 | |
… | |
… | |
1388 | } |
1371 | } |
1389 | |
1372 | |
1390 | return result; |
1373 | return result; |
1391 | } |
1374 | } |
1392 | |
1375 | |
1393 | bool |
1376 | void |
1394 | bgPixmap_t::set_root_pixmap () |
1377 | bgPixmap_t::set_root_pixmap () |
1395 | { |
1378 | { |
1396 | Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1379 | Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1397 | if (new_root_pixmap == None) |
1380 | if (new_root_pixmap == None) |
1398 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1381 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1399 | |
1382 | |
1400 | if (new_root_pixmap != root_pixmap) |
|
|
1401 | { |
|
|
1402 | root_pixmap = new_root_pixmap; |
1383 | root_pixmap = new_root_pixmap; |
1403 | return true; |
1384 | |
|
|
1385 | // validate root pixmap |
|
|
1386 | if (root_pixmap != None) |
1404 | } |
1387 | { |
|
|
1388 | unsigned int width, height; |
|
|
1389 | Window wdummy; |
|
|
1390 | int idummy; |
|
|
1391 | unsigned int udummy; |
1405 | |
1392 | |
1406 | return false; |
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 | } |
1407 | } |
1400 | } |
1408 | # endif /* ENABLE_TRANSPARENCY */ |
1401 | # endif /* ENABLE_TRANSPARENCY */ |
1409 | |
1402 | |
1410 | # ifndef HAVE_AFTERIMAGE |
1403 | # ifndef HAVE_AFTERIMAGE |
1411 | static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm); |
1404 | static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm); |
… | |
… | |
1451 | |
1444 | |
1452 | if (result) |
1445 | if (result) |
1453 | { |
1446 | { |
1454 | # if !defined(HAVE_AFTERIMAGE) && !XFT |
1447 | # if !defined(HAVE_AFTERIMAGE) && !XFT |
1455 | /* our own client-side tinting */ |
1448 | /* our own client-side tinting */ |
1456 | /* ATTENTION: We ASSUME that XFT will let us do all the tinting necessary server-side. |
|
|
1457 | This may need to be changed in need_client_side_rendering() logic is altered !!! */ |
|
|
1458 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1449 | if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) |
1459 | { |
1450 | { |
1460 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1451 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1461 | if (flags & tintSet) |
1452 | if (flags & tintSet) |
1462 | tint.get (c); |
1453 | tint.get (c); |
… | |
… | |
1540 | void |
1531 | void |
1541 | bgPixmap_t::apply () |
1532 | bgPixmap_t::apply () |
1542 | { |
1533 | { |
1543 | if (target) |
1534 | if (target) |
1544 | { |
1535 | { |
1545 | flags &= ~isVtOrigin; |
|
|
1546 | |
|
|
1547 | if (pixmap != None) |
1536 | if (pixmap != None) |
1548 | { |
1537 | { |
1549 | /* set target's background to pixmap */ |
1538 | /* set target's background to pixmap */ |
1550 | # ifdef ENABLE_TRANSPARENCY |
1539 | # ifdef ENABLE_TRANSPARENCY |
1551 | if (flags & isTransparent) |
1540 | if (flags & isTransparent) |
… | |
… | |
1557 | XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); |
1546 | XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); |
1558 | } |
1547 | } |
1559 | else |
1548 | else |
1560 | # endif |
1549 | # endif |
1561 | { |
1550 | { |
1562 | flags |= isVtOrigin; |
|
|
1563 | /* force old pixmap dereference in case it was transparent before :*/ |
1551 | /* force old pixmap dereference in case it was transparent before :*/ |
1564 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
1552 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
1565 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
1553 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
1566 | /* do we also need to set scrollbar's background here ? */ |
1554 | /* do we also need to set scrollbar's background here ? */ |
1567 | |
1555 | |