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

Function create_message_window

win/X11/winmesg.c:72–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void
73create_message_window(struct xwindow *wp, /* window pointer */
74 boolean create_popup, Widget parent)
75{
76 Arg args[8];
77 Cardinal num_args;
78 Widget viewport;
79 struct mesg_info_t *mesg_info;
80
81 wp->type = NHW_MESSAGE;
82
83 wp->mesg_information = mesg_info =
84 (struct mesg_info_t *) alloc(sizeof (struct mesg_info_t));
85
86 mesg_info->fs = 0;
87 mesg_info->num_lines = 0;
88 mesg_info->head = mesg_info->line_here = mesg_info->last_pause =
89 mesg_info->last_pause_head = (struct line_element *) 0;
90 mesg_info->dirty = False;
91 mesg_info->viewport_width = mesg_info->viewport_height = 0;
92
93 if (iflags.msg_history < (unsigned) appResources.message_lines)
94 iflags.msg_history = (unsigned) appResources.message_lines;
95 if (iflags.msg_history > MAX_MSG_HISTORY) /* a sanity check */
96 iflags.msg_history = MAX_MSG_HISTORY;
97
98 set_circle_buf(mesg_info, (int) iflags.msg_history);
99
100 /* Create a popup that becomes the parent. */
101 if (create_popup) {
102 num_args = 0;
103 XtSetArg(args[num_args], XtNallowShellResize, True);
104 num_args++;
105
106 wp->popup = parent =
107 XtCreatePopupShell("message_popup", topLevelShellWidgetClass,
108 toplevel, args, num_args);
109 /*
110 * If we're here, then this is an auxiliary message window. If we're
111 * cancelled via a delete window message, we should just pop down.
112 */
113 }
114
115 /*
116 * Create the viewport. We only want the vertical scroll bar ever to be
117 * visible. If we allow the horizontal scrollbar to be visible it will
118 * always be visible, due to the stupid way the Athena viewport operates.
119 */
120 num_args = 0;
121 XtSetArg(args[num_args], XtNallowVert, True);
122 num_args++;
123 viewport = XtCreateManagedWidget(
124 "mesg_viewport", /* name */
125 viewportWidgetClass, /* widget class from Window.h */
126 parent, /* parent widget */
127 args, /* set some values */
128 num_args); /* number of values to set */
129

Callers 2

X11_create_nhwindowFunction · 0.85
init_standard_windowsFunction · 0.85

Calls 3

set_circle_bufFunction · 0.85
get_gcFunction · 0.85
allocFunction · 0.50

Tested by

no test coverage detected