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

Function gend_key

win/X11/winmisc.c:266–296  ·  view source on GitHub ↗

ARGSUSED */

Source from the content-addressed store, hash-verified

264
265/* ARGSUSED */
266void
267gend_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
268{
269 char ch, *mark;
270 static char gendchars[] = "mf";
271
272 nhUse(w);
273 nhUse(params);
274 nhUse(num_params);
275
276 ch = key_event_to_char((XKeyEvent *) event);
277 if (ch == '\0') { /* don't accept nul char/modifier event */
278 /* don't beep */
279 return;
280 }
281 mark = strchr(gendchars, ch);
282 if (!mark)
283 mark = strchr(gendchars, lowc(ch));
284 if (!mark) {
285 if (strchr(ps_randchars, ch))
286 ps_selected = PS_RANDOM;
287 else if (strchr(ps_quitchars, ch))
288 ps_selected = PS_QUIT;
289 else {
290 X11_nhbell(); /* no such gender */
291 return;
292 }
293 } else
294 ps_selected = (int) (mark - gendchars);
295 exit_x_event = TRUE;
296}
297
298/* ARGSUSED */
299void

Callers

nothing calls this directly

Calls 3

key_event_to_charFunction · 0.85
X11_nhbellFunction · 0.85
lowcFunction · 0.50

Tested by

no test coverage detected