Mercurial > emacs
comparison src/xterm.c @ 2840:12299f73584e
(dumpglyphs): Create a temporary merged gc
when cursor falls on char with non-default face.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 16 May 1993 22:32:36 +0000 |
parents | 55e9c556bbf8 |
children | 11eced50eaa6 |
comparison
equal
deleted
inserted
replaced
2839:8c43cc245dd2 | 2840:12299f73584e |
---|---|
454 determined by the face code CF. */ | 454 determined by the face code CF. */ |
455 { | 455 { |
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 | 459 int defaulted = 1; |
460 /* Cursor display take full precidence. */ | 460 int gc_temporary = 0; |
461 if (hl == 2) | 461 |
462 { | 462 /* First look at the face of the text itself. */ |
463 gc = (f->display.x->cursor_gc); | 463 if (cf != 0) |
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. */ |
471 if (cf < 0 || cf >= FRAME_N_FACES (f)) | 467 if (cf < 0 || cf >= FRAME_N_FACES (f)) |
472 abort (); | 468 abort (); |
475 face = FRAME_MODE_LINE_FACE (f); | 471 face = FRAME_MODE_LINE_FACE (f); |
476 else | 472 else |
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. */ |
483 else if (hl == 0) | 480 else if (hl == 0) |
484 ; | 481 ; |
485 else if (hl == 1) | 482 else if (hl == 1) |
486 { | 483 { |
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); |
520 | |
521 if (gc_temporary) | |
522 XFreeGC (x_current_display, gc); | |
494 | 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. */ |
498 { | 527 { |