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

Function invert_line

win/X11/winmenu.c:194–217  ·  view source on GitHub ↗

* Invert the count'th line (curr) in the given window. */ ARGSUSED*/

Source from the content-addressed store, hash-verified

192 */
193/*ARGSUSED*/
194static void
195invert_line(struct xwindow *wp, x11_menu_item *curr, int which, long how_many)
196{
197 Arg args[2];
198
199 nhUse(which);
200 reset_menu_count(wp->menu_information);
201 /* invert selection unless explicitly choosing the preselected
202 entry of a PICK_ONE menu */
203 if (wp->menu_information->how != PICK_ONE || !curr->preselected)
204 curr->selected = !curr->selected;
205 curr->preselected = FALSE;
206 if (curr->selected) {
207 curr->str[2] = (how_many != -1) ? '#' : '+';
208 XtSetArg(args[0], nhStr(XtNlabel), curr->str);
209 XtSetValues(curr->w, args, ONE);
210 curr->pick_count = how_many;
211 } else {
212 curr->str[2] = '-';
213 XtSetArg(args[0], nhStr(XtNlabel), curr->str);
214 XtSetValues(curr->w, args, ONE);
215 curr->pick_count = -1L;
216 }
217}
218
219static XEvent fake_perminv_event;
220

Callers 6

menu_keyFunction · 0.85
select_allFunction · 0.85
select_noneFunction · 0.85
invert_allFunction · 0.85
invert_matchFunction · 0.85
select_matchFunction · 0.85

Calls 1

reset_menu_countFunction · 0.50

Tested by

no test coverage detected