MCPcopy Create free account
hub / github.com/NetHack/NetHack / redraw_message_window

Function redraw_message_window

win/X11/winmesg.c:447–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447static void
448redraw_message_window(struct xwindow *wp)
449{
450 struct mesg_info_t *mesg_info = wp->mesg_information;
451 struct line_element *curr;
452 int row, y_base;
453
454 /*
455 * Do this the cheap and easy way. Clear the window and just redraw
456 * the whole thing.
457 *
458 * This could be done more efficiently with one call to XDrawText() instead
459 * of many calls to XDrawString(). Maybe later.
460 *
461 * Only need to clear if window has new text.
462 */
463 if (mesg_info->dirty) {
464 XClearWindow(XtDisplay(wp->w), XtWindow(wp->w));
465 mesg_info->line_here = mesg_info->last_pause;
466 }
467
468 /* For now, just update the whole shootn' match. */
469 for (y_base = row = 0, curr = mesg_info->head; row < mesg_info->num_lines;
470 row++, y_base += mesg_info->char_height, curr = curr->next) {
471 XDrawString(XtDisplay(wp->w), XtWindow(wp->w), mesg_info->gc,
472 mesg_info->char_lbearing, mesg_info->char_ascent + y_base,
473 curr->line, curr->str_length);
474 /*
475 * This draws a line at the _top_ of the line of text pointed to by
476 * mesg_info->last_pause.
477 */
478 if (appResources.message_line && curr == mesg_info->line_here) {
479 XDrawLine(XtDisplay(wp->w), XtWindow(wp->w), mesg_info->gc, 0,
480 y_base, wp->pixel_width, y_base);
481 }
482 }
483
484 mesg_info->dirty = False;
485}
486
487/*
488 * Check the size of the viewport. If it has shrunk, then we want to

Callers 3

display_message_windowFunction · 0.85
winmesg.cFile · 0.85
mesg_exposedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected