diff options
| author | Richard M. Stallman | 1993-05-16 22:32:36 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-16 22:32:36 +0000 |
| commit | b73b6aaf28bd2d72ca333784fb8dc58adb1b5473 (patch) | |
| tree | b2dc30ea9af3cccc421dc4ac789a8803c272a78b /src | |
| parent | 61d54cd5408b730c86753aaf5c43a92b91f92b6f (diff) | |
| download | emacs-b73b6aaf28bd2d72ca333784fb8dc58adb1b5473.tar.gz emacs-b73b6aaf28bd2d72ca333784fb8dc58adb1b5473.zip | |
(dumpglyphs): Create a temporary merged gc
when cursor falls on char with non-default face.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c index 58733c1efa3..50927c92663 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -456,15 +456,11 @@ dumpglyphs (f, left, top, gp, n, hl) | |||
| 456 | struct face *face = FRAME_DEFAULT_FACE (f); | 456 | struct face *face = FRAME_DEFAULT_FACE (f); |
| 457 | FONT_TYPE *font = FACE_FONT (face); | 457 | FONT_TYPE *font = FACE_FONT (face); |
| 458 | GC gc = FACE_GC (face); | 458 | GC gc = FACE_GC (face); |
| 459 | int defaulted = 1; | ||
| 460 | int gc_temporary = 0; | ||
| 459 | 461 | ||
| 460 | /* Cursor display take full precidence. */ | 462 | /* First look at the face of the text itself. */ |
| 461 | if (hl == 2) | 463 | if (cf != 0) |
| 462 | { | ||
| 463 | gc = (f->display.x->cursor_gc); | ||
| 464 | } | ||
| 465 | |||
| 466 | /* Then comes faces of the text itself. */ | ||
| 467 | else if (cf != 0) | ||
| 468 | { | 464 | { |
| 469 | /* The face codes on the glyphs must be valid indices into the | 465 | /* The face codes on the glyphs must be valid indices into the |
| 470 | frame's face table. */ | 466 | frame's face table. */ |
| @@ -477,6 +473,7 @@ dumpglyphs (f, left, top, gp, n, hl) | |||
| 477 | face = intern_face (f, FRAME_FACES (f) [cf]); | 473 | face = intern_face (f, FRAME_FACES (f) [cf]); |
| 478 | font = FACE_FONT (face); | 474 | font = FACE_FONT (face); |
| 479 | gc = FACE_GC (face); | 475 | gc = FACE_GC (face); |
| 476 | defaulted = 0; | ||
| 480 | } | 477 | } |
| 481 | 478 | ||
| 482 | /* Then comes the distinction between modeline and normal text. */ | 479 | /* Then comes the distinction between modeline and normal text. */ |
| @@ -487,11 +484,43 @@ dumpglyphs (f, left, top, gp, n, hl) | |||
| 487 | face = FRAME_MODE_LINE_FACE (f); | 484 | face = FRAME_MODE_LINE_FACE (f); |
| 488 | font = FACE_FONT (face); | 485 | font = FACE_FONT (face); |
| 489 | gc = FACE_GC (face); | 486 | gc = FACE_GC (face); |
| 487 | defaulted = 0; | ||
| 488 | } | ||
| 489 | |||
| 490 | #define FACE_DEFAULT (~0) | ||
| 491 | |||
| 492 | /* Now override that if the cursor's on this character. */ | ||
| 493 | if (hl == 2 && (defaulted | ||
| 494 | || !(face->font && (int) face->font != FACE_DEFAULT))) | ||
| 495 | { | ||
| 496 | gc = f->display.x->cursor_gc; | ||
| 497 | } | ||
| 498 | /* Cursor on non-default face: must merge. */ | ||
| 499 | else if (hl == 2) | ||
| 500 | { | ||
| 501 | XGCValues xgcv; | ||
| 502 | unsigned long mask; | ||
| 503 | |||
| 504 | xgcv.background = f->display.x->cursor_pixel; | ||
| 505 | xgcv.foreground = f->display.x->cursor_foreground_pixel; | ||
| 506 | xgcv.font = face->font->fid; | ||
| 507 | xgcv.graphics_exposures = 0; | ||
| 508 | mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; | ||
| 509 | gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f), | ||
| 510 | mask, &xgcv); | ||
| 511 | #if 0 | ||
| 512 | if (face->stipple && face->stipple != FACE_DEFAULT) | ||
| 513 | XSetStipple (x_current_display, gc, face->stipple); | ||
| 514 | #endif | ||
| 515 | gc_temporary = 1; | ||
| 490 | } | 516 | } |
| 491 | 517 | ||
| 492 | XDrawImageString (x_current_display, window, gc, | 518 | XDrawImageString (x_current_display, window, gc, |
| 493 | left, top + FONT_BASE (font), buf, len); | 519 | left, top + FONT_BASE (font), buf, len); |
| 494 | 520 | ||
| 521 | if (gc_temporary) | ||
| 522 | XFreeGC (x_current_display, gc); | ||
| 523 | |||
| 495 | /* We should probably check for XA_UNDERLINE_POSITION and | 524 | /* We should probably check for XA_UNDERLINE_POSITION and |
| 496 | XA_UNDERLINE_THICKNESS properties on the font, but let's | 525 | XA_UNDERLINE_THICKNESS properties on the font, but let's |
| 497 | just get the thing working, and come back to that. */ | 526 | just get the thing working, and come back to that. */ |