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

Function get_text_gc

win/X11/winmap.c:945–977  ·  view source on GitHub ↗

* Create the GC's for each color. * * I'm not sure if it is a good idea to have a GC for each color (and * inverse). It might be faster to just modify the foreground and * background colors on the current GC as needed. */

Source from the content-addressed store, hash-verified

943 * background colors on the current GC as needed.
944 */
945static void
946get_text_gc(struct xwindow *wp, Font font)
947{
948 struct map_info_t *map_info = wp->map_information;
949 Pixel bgpixel;
950 Arg arg[1];
951
952 /* Get background pixel. */
953 XtSetArg(arg[0], XtNbackground, &bgpixel);
954 XtGetValues(wp->w, arg, ONE);
955
956#define set_color_gc(nh_color, resource_name) \
957 set_gc(wp->w, font, resource_name, bgpixel, \
958 &map_info->text_map.color_gcs[nh_color], \
959 &map_info->text_map.inv_color_gcs[nh_color]);
960
961 set_color_gc(CLR_BLACK, XtNblack);
962 set_color_gc(CLR_RED, XtNred);
963 set_color_gc(CLR_GREEN, XtNgreen);
964 set_color_gc(CLR_BROWN, XtNbrown);
965 set_color_gc(CLR_BLUE, XtNblue);
966 set_color_gc(CLR_MAGENTA, XtNmagenta);
967 set_color_gc(CLR_CYAN, XtNcyan);
968 set_color_gc(CLR_GRAY, XtNgray);
969 set_color_gc(NO_COLOR, XtNforeground);
970 set_color_gc(CLR_ORANGE, XtNorange);
971 set_color_gc(CLR_BRIGHT_GREEN, XtNbright_green);
972 set_color_gc(CLR_YELLOW, XtNyellow);
973 set_color_gc(CLR_BRIGHT_BLUE, XtNbright_blue);
974 set_color_gc(CLR_BRIGHT_MAGENTA, XtNbright_magenta);
975 set_color_gc(CLR_BRIGHT_CYAN, XtNbright_cyan);
976 set_color_gc(CLR_WHITE, XtNwhite);
977}
978
979/*
980 * Display the cursor on the map window.

Callers 1

init_textFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected