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

Function init_standard_windows

win/X11/winX.c:2584–2782  ·  view source on GitHub ↗

* Set up the playing console. This has three major parts: the * message window, the map, and the status window. * * For configs specifying the 'slow' resource, the yn_label widget * is placed above the map and below the message window. Prompts * requiring a single character response are displayed there rather * than using a popup. */

Source from the content-addressed store, hash-verified

2582 * than using a popup.
2583 */
2584static void
2585init_standard_windows(void)
2586{
2587 Widget form, message_viewport, map_viewport, status;
2588 Arg args[8];
2589 Cardinal num_args;
2590 Dimension message_vp_width, map_vp_width, status_width, max_width;
2591 int map_vp_hd, status_hd;
2592 struct xwindow *wp;
2593
2594 num_args = 0;
2595 XtSetArg(args[num_args], XtNallowShellResize, True); num_args++;
2596 form = XtCreateManagedWidget("nethack", panedWidgetClass, toplevel, args,
2597 num_args);
2598
2599 XtAddEventHandler(form, KeyPressMask, False, (XtEventHandler) msgkey,
2600 (XtPointer) 0);
2601
2602 if (appResources.autofocus)
2603 XtAddEventHandler(toplevel, VisibilityChangeMask, False, win_visible,
2604 (XtPointer) 0);
2605
2606 /*
2607 * Create message window.
2608 */
2609 WIN_MESSAGE = message_win = find_free_window();
2610 wp = &window_list[message_win];
2611 wp->cursx = wp->cursy = wp->pixel_width = wp->pixel_height = 0;
2612 wp->popup = (Widget) 0;
2613 create_message_window(wp, FALSE, form);
2614 message_viewport = XtParent(wp->w);
2615
2616 /* Tell the form that contains it that resizes are OK. */
2617 num_args = 0;
2618 XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
2619 XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
2620 XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
2621 XtSetValues(message_viewport, args, num_args);
2622
2623 if (appResources.slow) {
2624 num_args = 0;
2625 XtSetArg(args[num_args], XtNtranslations,
2626 XtParseTranslationTable(yn_translations)); num_args++;
2627 yn_label = XtCreateManagedWidget("yn_label", labelWidgetClass, form,
2628 args, num_args);
2629 num_args = 0;
2630 XtSetArg(args[num_args], nhStr(XtNfromVert), message_viewport);
2631 num_args++;
2632 XtSetArg(args[num_args], nhStr(XtNjustify), XtJustifyLeft);
2633 num_args++;
2634 XtSetArg(args[num_args], nhStr(XtNresizable), True); num_args++;
2635 XtSetArg(args[num_args], nhStr(XtNlabel), " "); num_args++;
2636 XtSetValues(yn_label, args, num_args);
2637 }
2638
2639 /*
2640 * Create the map window & viewport and chain the viewport beneath the
2641 * message_viewport.

Callers 1

X11_init_nhwindowsFunction · 0.85

Calls 9

find_free_windowFunction · 0.85
create_message_windowFunction · 0.85
create_map_windowFunction · 0.85
create_status_windowFunction · 0.85
post_process_tilesFunction · 0.85
null_out_statusFunction · 0.85
set_map_sizeFunction · 0.85
set_message_sliderFunction · 0.85
highlight_ynFunction · 0.85

Tested by

no test coverage detected