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

Function update_color

win/X11/winstat.c:1764–1793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1762}
1763
1764static void
1765update_color(struct X_status_value *sv, int color)
1766{
1767 Pixel pixel = 0;
1768 Arg args[1];
1769 XrmValue source;
1770 XrmValue dest;
1771 Widget w = (sv->type == SV_LABEL || sv->type == SV_NAME) ? sv->w
1772 : get_value_widget(sv->w);
1773
1774 if (color == NO_COLOR) {
1775 if (sv->after_init)
1776 pixel = sv->default_fg;
1777 sv->colr = NO_COLOR;
1778 } else {
1779 source.addr = (XPointer) fancy_status_hilite_colors[color];
1780 source.size = (unsigned int) strlen((const char *) source.addr) + 1;
1781 dest.size = (unsigned int) sizeof (Pixel);
1782 dest.addr = (XPointer) &pixel;
1783 if (XtConvertAndStore(w, XtRString, &source, XtRPixel, &dest))
1784 sv->colr = color;
1785 }
1786 if (pixel != 0) {
1787 char *arg_name = (sv->set || sv->inverted_hilite) ? XtNbackground
1788 : XtNforeground;
1789
1790 XtSetArg(args[0], arg_name, pixel);
1791 XtSetValues(w, args, ONE);
1792 }
1793}
1794
1795static boolean
1796name_widget_has_label(struct X_status_value *sv)

Callers 1

Calls 1

get_value_widgetFunction · 0.85

Tested by

no test coverage detected