… | |
… | |
232 | rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const |
232 | rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color) const |
233 | { |
233 | { |
234 | dTermDisplay; |
234 | dTermDisplay; |
235 | dTermGC; |
235 | dTermGC; |
236 | |
236 | |
237 | if (color < 0 || color == Color_bg) |
237 | if (color == Color_bg || color == Color_transparent) |
238 | XClearArea (disp, d, x, y, w, h, false); |
238 | XClearArea (disp, d, x, y, w, h, false); |
239 | else |
239 | else if (color >= 0) |
240 | { |
240 | { |
241 | #if XFT |
241 | #if XFT |
|
|
242 | bool done = false; |
|
|
243 | #ifdef HAVE_BG_PIXMAP |
|
|
244 | if (term->bgPixmap.pixmap && color >= 0 && term->pix_colors[color].c.color.alpha < 0x0ff00) |
|
|
245 | { |
|
|
246 | Picture dst = XftDrawPicture (d); |
|
|
247 | if (dst != 0) |
|
|
248 | { |
|
|
249 | XClearArea (disp, d, x, y, w, h, false); |
|
|
250 | Picture solid_color_pict = XftDrawSrcPicture (d, &term->pix_colors[color].c); |
|
|
251 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, x, y, w, h); |
|
|
252 | done = true; |
|
|
253 | } |
|
|
254 | } |
|
|
255 | #endif |
|
|
256 | if (!done) |
242 | XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); |
257 | XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h); |
243 | #else |
258 | #else |
244 | XSetForeground (disp, gc, term->pix_colors[color]); |
259 | XSetForeground (disp, gc, term->pix_colors[color]); |
245 | XFillRectangle (disp, d, gc, x, y, w, h); |
260 | XFillRectangle (disp, d, gc, x, y, w, h); |
246 | #endif |
261 | #endif |
247 | } |
262 | } |
… | |
… | |
441 | *chrs = cc->c2; |
456 | *chrs = cc->c2; |
442 | rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful) |
457 | rxvt_font *f2 = (f1->has_char (cc->c2, 0, careful) && !careful) |
443 | ? f1 |
458 | ? f1 |
444 | : (*fs)[fs->find_font (cc->c2)]; |
459 | : (*fs)[fs->find_font (cc->c2)]; |
445 | |
460 | |
446 | f2->draw (d, x, y, chrs, width, fg, -1); |
461 | f2->draw (d, x, y, chrs, width, fg, Color_none); |
447 | } |
462 | } |
448 | } |
463 | } |
449 | #endif |
464 | #endif |
450 | else |
465 | else |
451 | switch (t) |
466 | switch (t) |
… | |
… | |
497 | unsigned long value; |
512 | unsigned long value; |
498 | |
513 | |
499 | if (XGetFontProperty (f, property, &value)) |
514 | if (XGetFontProperty (f, property, &value)) |
500 | return XGetAtomName (term->dpy, value); |
515 | return XGetAtomName (term->dpy, value); |
501 | else |
516 | else |
502 | return rxvt_strdup (repl); |
517 | return repl ? strdup (repl) : 0; |
503 | } |
518 | } |
504 | |
519 | |
505 | rxvt_fontprop |
520 | rxvt_fontprop |
506 | rxvt_font_x11::properties () |
521 | rxvt_font_x11::properties () |
507 | { |
522 | { |
… | |
… | |
1043 | |
1058 | |
1044 | void draw (rxvt_drawable &d, int x, int y, |
1059 | void draw (rxvt_drawable &d, int x, int y, |
1045 | const text_t *text, int len, |
1060 | const text_t *text, int len, |
1046 | int fg, int bg); |
1061 | int fg, int bg); |
1047 | |
1062 | |
1048 | bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &carefull) const; |
1063 | bool has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &careful) const; |
1049 | |
1064 | |
1050 | protected: |
1065 | protected: |
1051 | XftFont *f; |
1066 | XftFont *f; |
1052 | }; |
1067 | }; |
1053 | |
1068 | |
… | |
… | |
1272 | dTermGC; |
1287 | dTermGC; |
1273 | |
1288 | |
1274 | int w = term->fwidth * len; |
1289 | int w = term->fwidth * len; |
1275 | int h = term->fheight; |
1290 | int h = term->fheight; |
1276 | |
1291 | |
1277 | bool buffered = bg >= 0 // we don't use a transparent bg |
1292 | /* TODO: this logic needs some more thinking, since we no longer do pseudo-transparency. |
|
|
1293 | * Maybe make buffering into a resource flag? Compile time option doesn't seems like a |
|
|
1294 | * good idea from the perspective of packaging for wide variety of user configs. |
|
|
1295 | */ |
|
|
1296 | bool buffered = true |
1278 | #ifndef FORCE_UNBUFFERED_XFT |
1297 | #ifdef FORCE_UNBUFFERED_XFT |
1279 | # if defined(XPM_BACKGROUND) || defined(TRANSPARENT) |
1298 | && bg >= 0 |
1280 | || !term->am_transparent // we aren't transparent |
|
|
1281 | || term->am_pixmap_trans // we have a pixmap |
|
|
1282 | # endif |
|
|
1283 | #endif |
1299 | #endif |
1284 | ; |
1300 | ; |
1285 | |
|
|
1286 | // cut trailing spaces |
1301 | // cut trailing spaces |
1287 | while (len && text [len - 1] == ' ') |
1302 | while (len && text [len - 1] == ' ') |
1288 | len--; |
1303 | len--; |
1289 | |
1304 | |
1290 | int x_ = buffered ? 0 : x; |
1305 | int x_ = buffered ? 0 : x; |
… | |
… | |
1316 | x_ += cwidth; |
1331 | x_ += cwidth; |
1317 | } |
1332 | } |
1318 | |
1333 | |
1319 | if (buffered) |
1334 | if (buffered) |
1320 | { |
1335 | { |
|
|
1336 | bool back_rendered = false; |
1321 | if (ep != enc) |
1337 | if (ep != enc) |
1322 | { |
1338 | { |
1323 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1339 | rxvt_drawable &d2 = d.screen->scratch_drawable (w, h); |
1324 | |
1340 | |
1325 | if (0) |
1341 | #ifdef HAVE_BG_PIXMAP |
1326 | ; |
|
|
1327 | #ifdef TRANSPARENT |
|
|
1328 | else if (bg < 0 && term->am_pixmap_trans) |
|
|
1329 | XCopyArea (disp, term->pixmap, d2, gc, |
|
|
1330 | x + term->window_vt_x, y + term->window_vt_y, |
|
|
1331 | w, h, 0, 0); |
|
|
1332 | #endif |
|
|
1333 | #ifdef XPM_BACKGROUND |
|
|
1334 | else if (bg < 0 && term->bgPixmap.pixmap) |
1342 | if (term->bgPixmap.pixmap) |
1335 | { |
1343 | { |
|
|
1344 | Picture dst = 0; |
|
|
1345 | |
|
|
1346 | if (bg >= 0 && term->pix_colors[bg].c.color.alpha < 0x0ff00) |
|
|
1347 | dst = XftDrawPicture (d2); |
|
|
1348 | |
|
|
1349 | if (bg < 0 || dst != 0) |
|
|
1350 | { |
|
|
1351 | int src_x = x, src_y = y ; |
|
|
1352 | |
|
|
1353 | if (term->bgPixmap.is_parentOrigin ()) |
|
|
1354 | { |
|
|
1355 | src_x += term->window_vt_x; |
|
|
1356 | src_y += term->window_vt_y; |
|
|
1357 | } |
|
|
1358 | |
|
|
1359 | if (term->bgPixmap.pmap_width >= src_x+w |
|
|
1360 | && term->bgPixmap.pmap_height >= src_y+h) |
|
|
1361 | { |
|
|
1362 | XCopyArea (disp, term->bgPixmap.pixmap, d2, gc, |
|
|
1363 | src_x, src_y, w, h, 0, 0); |
|
|
1364 | } |
|
|
1365 | else |
|
|
1366 | { |
1336 | XGCValues gcv; |
1367 | XGCValues gcv; |
1337 | |
1368 | |
1338 | gcv.fill_style = FillTiled; |
1369 | gcv.fill_style = FillTiled; |
1339 | gcv.tile = term->pixmap; |
1370 | gcv.tile = term->bgPixmap.pixmap; |
1340 | gcv.ts_x_origin = -x; |
1371 | gcv.ts_x_origin = -src_x; |
1341 | gcv.ts_y_origin = -y; |
1372 | gcv.ts_y_origin = -src_y; |
1342 | |
1373 | |
1343 | GC gc2 = XCreateGC (disp, d2, |
1374 | XChangeGC (disp, gc, |
1344 | GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, |
1375 | GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle, |
1345 | &gcv); |
1376 | &gcv); |
1346 | |
1377 | |
1347 | XFillRectangle (disp, d2, gc2, 0, 0, w, h); |
1378 | XFillRectangle (disp, d2, gc, 0, 0, w, h); |
1348 | |
1379 | |
1349 | XFreeGC (disp, gc2); |
1380 | gcv.fill_style = FillSolid; |
|
|
1381 | XChangeGC (disp, gc, GCFillStyle, &gcv); |
|
|
1382 | } |
|
|
1383 | |
|
|
1384 | if (bg >= 0) |
|
|
1385 | { |
|
|
1386 | Picture solid_color_pict = XftDrawSrcPicture (d2, &term->pix_colors[bg].c); |
|
|
1387 | XRenderComposite (disp, PictOpOver, solid_color_pict, None, dst, 0, 0, 0, 0, 0, 0, w, h); |
|
|
1388 | } |
|
|
1389 | |
|
|
1390 | back_rendered = true; |
|
|
1391 | } |
1350 | } |
1392 | } |
1351 | #endif |
1393 | #endif |
1352 | else |
1394 | |
|
|
1395 | if (bg >= 0 && !back_rendered) |
1353 | XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); |
1396 | XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h); |
1354 | |
1397 | |
1355 | XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); |
1398 | XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc); |
1356 | XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); |
1399 | XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y); |
1357 | } |
1400 | } |