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

Function highlight_yn

win/X11/winX.c:2545–2573  ·  view source on GitHub ↗

if 'slow' and 'highlight_prompt', set the yn_label widget to look like part of the map when idle or to invert background and foreground when a prompt is active */

Source from the content-addressed store, hash-verified

2543 part of the map when idle or to invert background and foreground when
2544 a prompt is active */
2545void
2546highlight_yn(boolean init)
2547{
2548 struct xwindow *xmap;
2549
2550 if (!appResources.slow || !appResources.highlight_prompt)
2551 return;
2552
2553 /* first time through, WIN_MAP isn't fully initialized yet */
2554 xmap = ((map_win != WIN_ERR) ? &window_list[map_win]
2555 : (WIN_MAP != WIN_ERR) ? &window_list[WIN_MAP] : 0);
2556
2557 if (init && xmap) {
2558 Arg args[2];
2559 XGCValues vals;
2560 unsigned long fg_bg = (GCForeground | GCBackground);
2561 GC ggc = (xmap->map_information->is_tile
2562 ? xmap->map_information->tile_map.white_gc
2563 : xmap->map_information->text_map.copy_gc);
2564
2565 (void) memset((genericptr_t) &vals, 0, sizeof vals);
2566 if (XGetGCValues(XtDisplay(xmap->w), ggc, fg_bg, &vals)) {
2567 XtSetArg(args[0], XtNforeground, vals.foreground);
2568 XtSetArg(args[1], XtNbackground, vals.background);
2569 XtSetValues(yn_label, args, TWO);
2570 }
2571 } else
2572 swap_fg_bg(yn_label);
2573}
2574
2575/*
2576 * Set up the playing console. This has three major parts: the

Callers 3

X11_yn_function_coreFunction · 0.85
init_standard_windowsFunction · 0.85
display_map_windowFunction · 0.85

Calls 1

swap_fg_bgFunction · 0.85

Tested by

no test coverage detected