… | |
… | |
22 | #include "../config.h" |
22 | #include "../config.h" |
23 | #include "rxvt.h" |
23 | #include "rxvt.h" |
24 | #include "rxvtutil.h" |
24 | #include "rxvtutil.h" |
25 | #include "rxvtfont.h" |
25 | #include "rxvtfont.h" |
26 | |
26 | |
27 | #include <cstdlib> |
27 | #include <stdlib.h> |
28 | |
28 | |
29 | #include <inttypes.h> |
29 | #include <inttypes.h> |
30 | |
30 | |
31 | #if XFT |
31 | #if XFT |
32 | # include <fontconfig/fontconfig.h> |
32 | # include <fontconfig/fontconfig.h> |
… | |
… | |
240 | { |
240 | { |
241 | #if XFT |
241 | #if XFT |
242 | Picture dst; |
242 | Picture dst; |
243 | |
243 | |
244 | # ifdef HAVE_BG_PIXMAP |
244 | # ifdef HAVE_BG_PIXMAP |
245 | if (term->bg_pixmap |
245 | if (term->bg_img |
246 | && !term->pix_colors[color].is_opaque () |
246 | && !term->pix_colors[color].is_opaque () |
247 | && ((dst = XftDrawPicture (d)))) |
247 | && ((dst = XftDrawPicture (d)))) |
248 | { |
248 | { |
249 | XClearArea (disp, d, x, y, w, h, false); |
249 | XClearArea (disp, d, x, y, w, h, false); |
250 | |
250 | |
… | |
… | |
816 | XFreeFontNames (list); |
816 | XFreeFontNames (list); |
817 | |
817 | |
818 | // this loop only iterates when the guessed font-size is too small |
818 | // this loop only iterates when the guessed font-size is too small |
819 | for (;;) |
819 | for (;;) |
820 | { |
820 | { |
821 | font_weight *best = fonts + count - 1; |
821 | font_weight *best = fonts; |
822 | |
822 | |
823 | for (font_weight *w = fonts; w < best; w++) |
823 | for (font_weight *w = fonts + 1; w < fonts + count; w++) |
824 | if (w->diff <= best->diff) |
824 | if (w->diff < best->diff) |
825 | best = w; |
825 | best = w; |
826 | |
826 | |
827 | if (!best->name |
827 | if (!best->name |
828 | || !(f = XLoadQueryFont (disp, best->name))) |
828 | || !(f = XLoadQueryFont (disp, best->name))) |
829 | break; |
829 | break; |
… | |
… | |
1411 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1411 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1412 | |
1412 | |
1413 | #ifdef HAVE_BG_PIXMAP |
1413 | #ifdef HAVE_BG_PIXMAP |
1414 | Picture dst = 0; // the only assignment is done conditionally in the following if condition |
1414 | Picture dst = 0; // the only assignment is done conditionally in the following if condition |
1415 | |
1415 | |
1416 | if (term->bg_pixmap |
1416 | if (term->bg_img |
1417 | && (bg == Color_transparent || bg == Color_bg |
1417 | && (bg == Color_transparent || bg == Color_bg |
1418 | || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) |
1418 | || (bg >= 0 && !term->pix_colors[bg].is_opaque () && ((dst = XftDrawPicture (d2)))))) |
1419 | { |
1419 | { |
1420 | int src_x = x, src_y = y; |
1420 | int src_x = x, src_y = y; |
1421 | |
1421 | |
… | |
… | |
1423 | { |
1423 | { |
1424 | src_x += term->window_vt_x; |
1424 | src_x += term->window_vt_x; |
1425 | src_y += term->window_vt_y; |
1425 | src_y += term->window_vt_y; |
1426 | } |
1426 | } |
1427 | |
1427 | |
1428 | if (term->bg_pmap_width >= src_x + w |
1428 | if (term->bg_img->w >= src_x + w |
1429 | && term->bg_pmap_height >= src_y + h) |
1429 | && term->bg_img->h >= src_y + h) |
1430 | { |
1430 | { |
1431 | XCopyArea (disp, term->bg_pixmap, d2, gc, |
1431 | XCopyArea (disp, term->bg_img->pm, d2, gc, |
1432 | src_x, src_y, w, h, 0, 0); |
1432 | src_x, src_y, w, h, 0, 0); |
1433 | } |
1433 | } |
1434 | else |
1434 | else |
1435 | { |
1435 | { |
1436 | XGCValues gcv; |
1436 | XGCValues gcv; |
1437 | |
1437 | |
1438 | gcv.fill_style = FillTiled; |
1438 | gcv.fill_style = FillTiled; |
1439 | gcv.tile = term->bg_pixmap; |
1439 | gcv.tile = term->bg_img->pm; |
1440 | gcv.ts_x_origin = -src_x; |
1440 | gcv.ts_x_origin = -src_x; |
1441 | gcv.ts_y_origin = -src_y; |
1441 | gcv.ts_y_origin = -src_y; |
1442 | |
1442 | |
1443 | XChangeGC (disp, gc, |
1443 | XChangeGC (disp, gc, |
1444 | GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, |
1444 | GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, |
… | |
… | |
1785 | while (hi >= fmap.size ()) |
1785 | while (hi >= fmap.size ()) |
1786 | fmap.push_back (0); |
1786 | fmap.push_back (0); |
1787 | |
1787 | |
1788 | if (!fmap[hi]) |
1788 | if (!fmap[hi]) |
1789 | { |
1789 | { |
1790 | fmap[hi] = (pagemap *)new pagemap; |
1790 | fmap[hi] = new pagemap; |
1791 | memset (fmap[hi], 0xff, sizeof (pagemap)); |
1791 | memset (fmap[hi], 0xff, sizeof (pagemap)); |
1792 | } |
1792 | } |
1793 | |
1793 | |
1794 | (*fmap[hi])[unicode & 0xff] = i; |
1794 | (*fmap[hi])[unicode & 0xff] = i; |
1795 | } |
1795 | } |